На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

Adding an Item to a Header Control



The following example demonstrates how to use the HDM_INSERTITEM message and the HD_ITEM structure to add an item to a header control. The new item consists of a string that is left-justified within the item rectangle.

// DoInsertItem - inserts items into a header control.
// Returns the index of the newly added item.
// hwndHeader - handle of the header control
// iInsertAfter - index of the previous item
// nWidth - width of the new item
// lpsz - address of the item string
int DoInsertItem(HWND hwndHeader, int iInsertAfter,
int nWidth, LPSTR lpsz)
{
HD_ITEM hdi;
int index;

hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
hdi.pszText = lpsz;

hdi.cxy = nWidth;
hdi.cchTextMax = lstrlen(hdi.pszText);
hdi.fmt = HDF_LEFT | HDF_STRING;

index = SendMessage(hwndHeader, HDM_INSERTITEM,
(WPARAM) iInsertAfter, (LPARAM) &hdi);

return index;

}



Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

Дополнение Пункта на Управление Заголовка



Следующий пример демонстрирует как, чтобы использовать сообщение HDM_INSERTITEM и структура HD_ITEM, чтобы добавлять пункт к управлению заголовка. Новый пункт состоит из строки, которая - left-justified в пределах прямоугольника пункта.

// DoInsertItem - ВКЛЮЧАЕТ пункты на управление заголовка.
// Возврат индекс вновь дополнительного пункта.
// hwndHeader - Ручка управления / заголовка/ iInsertAfter - индекс предшествующего пункта // nWidth - ширина нового пункта // lpsz - адрес строки пункта int DoInsertItem(HWND hwndHeader, int iInsertAfter, int nWidth, LPSTR lpsz)
{
hdi HD_ITEM;
int индекс;

hdi.mask = HDI_TEXT | HDI_FORMAT | HDI_WIDTH;
hdi.pszText = lpsz;

hdi.cxy = nWidth;
hdi.cchTextMax = lstrlen(hdi.pszText);
hdi.fmt = HDF_LEFT | HDF_STRING;

проиндексируйте = SendMessage(hwndHeader, HDM_INSERTITEM, (WPARAM) iInsertAfter, (LPARAM) &hdi);

обратный индекс;

}



Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz