Поделиться через


CHeaderCtrl::GetOrderArray

Retrieves the left-to-right order of items in a header control.

BOOL GetOrderArray(
   LPINT piArray,
   int iCount
);

Параметры

  • piArray
    A pointer to the address of a buffer that receives the index values of the items in the header control, in the order in which they appear from left to right.

  • iCount
    The number of header control items. Must be non-negative.

Возвращаемое значение

Nonzero if successful; otherwise 0.

Заметки

This member function implements the behavior of the Win32 message HDM_GETORDERARRAY, as described in the Windows SDK. It is provided to support header item ordering.

Пример

// Reverse the order of the items in the header control.
// (i.e. make the first item the last one, the last item
// the first one, and so on ...).
int   nCount = m_myHeaderCtrl.GetItemCount();
LPINT pnOrder = (LPINT) malloc(nCount*sizeof(int));
ASSERT(pnOrder != NULL);
if (NULL != pnOrder)
{
   m_myHeaderCtrl.GetOrderArray(pnOrder, nCount);

   int i, j, nTemp;
   for (i=0, j=nCount-1; i < j; i++, j--)
   {
      nTemp = pnOrder[i];
      pnOrder[i] = pnOrder[j];
      pnOrder[j] = nTemp;
   }

   m_myHeaderCtrl.SetOrderArray(nCount, pnOrder);
   free(pnOrder);
}

Требования

Header: afxcmn.h

См. также

Основные понятия

CHeaderCtrl Class

CHeaderCtrl Members

Hierarchy Chart

CHeaderCtrl::SetOrderArray

CHeaderCtrl::OrderToIndex