views:

349

answers:

1

Hi,

I am trying to create owner drawn listbox on windows mobile 6.1 I have specified LBS_OWNERDRAWFIXED style while creating listbox control. I am handling WM_MEASUREITEM and WM_DRAWITEM accordingly.

I want to change height of listbox item whenever its font changes (I change it using WM_SETFONT after creating control). The problem is that WM_MEASUREITEM message gets sent only once. I need a way to generate WM_MEASUREITEM message again so that I can set height of item to height of font. I have seen following article http://www.codeguru.com/Cpp/controls/listview/advanced/article.php/c1013/ but it uses MFC. I am using native c++ to develop this control. Some articles mention that resizing the control generates WM_MEASUREITEM message again. However, it is not getting generated in my case.

Please let me know is there any way to achieve this in windows mobile. Thanks in advance.

A: 

There is nothing particularly MFC in that code. OnSetFont is, simply, handling WM_SETFONT. MeasureItem is handling, in the MyListCtrl, the WM_MEASUREITEM sent to its parent.

As for generating a new WM_MEASUREITEM when you resize the window can't you just do a SendMessage when handling the WM_SIZE/WM_SIZING?

Goz
Nilesh