![]() |
|
|
![]()
|
|
| Гость_Дмитрий |
|
|||
|
Unregistered |
Ребята, как в ListCtrl перехватить отрисовку итема? Я ловлю DrawItem. Там есть DRAWITEMSTRUCT. И какой из полей отвечает за текстовую строку в ListCtrl? А если будет несколько колонок (у меня так и есть)? С ListBox-ом у меня все получилось. А вот с ListCtrl...
И еще, как изменить высоту итемов? (В ListCtrl) Разумеется, ListCtrl имеет св-во OWNER_DRAW. Большое спасибо! |
|||
|
||||
| Tatarin |
|
|||
|
Новичок Профиль Группа: Участник Сообщений: 13 Регистрация: 5.1.2004 Где: Россия Репутация: нет Всего: нет |
статья из MSDN о том, как собственноручно перерисовывать всякие контроллы. Порезано для ListView
+++++++++++++++++++ Custom Draw With List-View Controls Because list-view controls have subitems and multiple display modes, you will need to handle the NM_CUSTOMDRAW notification somewhat differently than for the other common controls. For report mode: The first NM_CUSTOMDRAW notification will have the dwDrawStage member of the associated NMCUSTOMDRAW structure set to CDDS_PREPAINT. Return CDRF_NOTIFYITEMDRAW. You will then receive an NM_CUSTOMDRAW notification with dwDrawStage set to CDDS_ITEMPREPAINT. If you specify new fonts or colors and return CDRF_NEWFONT, all subitems of the item will be changed. If you want instead to handle each subitem separately, return CDRF_NOTIFYSUBITEMDRAW. If you returned CDRF_NOTIFYITEMDRAW in the previous step, you will then receive an NM_CUSTOMDRAW notification for each subitem with dwDrawStage set to CDDS_SUBITEM | CDDS_PREPAINT. To change the font or color for that subitem, specify a new font or color and return CDRF_NEWFONT. For the large icon, small icon, and list modes: The first NM_CUSTOMDRAW notification will have the dwDrawStage member of the associated NMCUSTOMDRAW structure set to CDDS_PREPAINT. Return CDRF_NOTIFYITEMDRAW. You will then receive an NM_CUSTOMDRAW notification with dwDrawStage set to CDDS_ITEMPREPAINT. You can change the fonts or colors of an item by specifying new fonts and colors and returning CDRF_NEWFONT. Because these modes do not have subitems, you will not receive any additional NM_CUSTOMDRAW notifications. An example of a list-view NM_CUSTOMDRAW notification handler is given in the next section. Using Custom Draw The following code fragment is a portion of a WM_NOTIFY handler that illustrates how to handle custom draw notifications sent to a list-view control: Example:
The first NM_CUSTOMDRAW notification has the dwDrawStage member of the NMCUSTOMDRAW structure set to CDDS_PREPAINT. The handler returns CDRF_NOTIFYITEMDRAW to indicate that it wishes to modify one or more items individually. The control then sends an NM_CUSTOMDRAW notification with dwDrawStage set to CDDS_PREPAINT for each item. The handler returns CDRF_NOTIFYITEMDRAW to indicate that it wishes to modify the item. If CDRF_NOTIFYITEMDRAW was returned in the previous step, the next NM_CUSTOMDRAW notification has dwDrawStage set to CDDS_ITEMPREPAINT. The handler retrieves the current color and font values. At this point, you can specify new values for small icon, large icon, and list modes. If the control is in report mode, you can also specify new values that will apply to all subitems of the item. If you have changed anything, return CDRF_NEWFONT. If the control is in report mode and you want to handle the subitems individually, return CDRF_NOTIFYSUBITEMREDRAW. The final notification is only sent if the control is in report mode and you returned CDRF_NOTIFYSUBITEMREDRAW in the previous step. The procedure for changing fonts and colors is the same as that step, but it only applies to a single subitem. Return CDRF_NEWFONT to notify the control if the color or font was changed. ++++++++++++++++++++++++++++ |
|||
|
||||
| Coocky |
|
||||
![]() GUI гуру ![]() ![]() ![]() ![]() Профиль Группа: Участник Клуба Сообщений: 2879 Регистрация: 16.2.2004 Где: Украина. Запорожь е Репутация: 25 Всего: 62 |
Конечно itemData Есть по этому поводу топик
Назови стиль списка -------------------- Верю в смерть после жизни, в любовь после секса ,в крем после бритья |
||||
|
|||||
| Гость_Дмитрий |
|
|||
|
Unregistered |
itemData имеет значение == 0!!!!!!!!!! Это в ListBox все так просто и itemData - char *. В ListCtrl все по другому. В ListCtrl при стиле отображения LVS_REPORT структура LPDRAWITEMSTRUCT соответствует всей строке, без разделения на юзерские колонки.
Попробую помучаться. Спасибо. |
|||
|
||||
| Coocky |
|
|||
![]() GUI гуру ![]() ![]() ![]() ![]() Профиль Группа: Участник Клуба Сообщений: 2879 Регистрация: 16.2.2004 Где: Украина. Запорожь е Репутация: 25 Всего: 62 |
Я ж сказал заполнить нужно изначально !Не мучайся ,завтра код вышлю -------------------- Верю в смерть после жизни, в любовь после секса ,в крем после бритья |
|||
|
||||
![]()
|
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
| 0 Пользователей: | |
| « Предыдущая тема | Visual C++/MFC/WTL | Следующая тема » |
|
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |