winapi - Why the DrawItem method of my owner draw listbox can't be called -
I try to write the owner draw list box with the wtl my code looks like this
Template & lt; Class T, Class TBZ = CLISBox, Square TWINTRAITS = CControlWinTraits & gt; Class ATL_NO_VTABLE CMyListBoxImpl: Public CWindowImpl & lt; T, Tables, Twintrats & gt ;, Public Condor Draw & lt; T & gt; {... BEGIN_MSG_MAP (CMyListBoxImpl) MESSAGE_HANDLER (WM_CREATE, OnCreate) MESSAGE_HANDLER (WM_DESTROY, OnDestroy) MESSAGE_HANDLER (WM_ERASEBKGND, OnEraseBackground) MESSAGE_HANDLER (WM_SIZE, OnSize) MESSAGE_HANDLER (WM_DRAWITEM, OnDrawItem) CHAIN_MSG_MAP (COwnerDraw & LT; t & gt;) DEFAULT_REFLECTION_HANDLER () END_MSG_MAP () ... Zero Init () {... ModifyStyle (0, BS_OWNERDRAW | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS); ...} Zero DrawItem (LPDRAWITEMSTRUCT lpdis) {...
I have also added REFLECT_NOTIFICATIONS
in the parent message loop, and the owner draws the property In the bed sheet is fixed. But I still can not get the message then I used the Spy ++ to get the message that the listbox was received, I received a message that is very strange ( WM_USER + 7211
). My OS is Winnspie and use VS 2008.
- BS_Enterdraw? This is a button style.
- Even with LBS_OWNERDRAWFIXED, you still have to handle WM_MEASUREITEM.
- Some control styles (such as) can set LBS_OWNERDRAWFIXED only control is created (What is it that you mean "owner du fix in property sheet" in the depot ?, If so, why modify the style in the code?)
It may also help ...
Comments
Post a Comment