I subclassed a CStatic...
-
... and added the SS_OWNERDRAW style, but I never get a call to DrawItem. Why? :confused: My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
... and added the SS_OWNERDRAW style, but I never get a call to DrawItem. Why? :confused: My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
show yur code where you subclass it.
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
BOOL CMyStatic::PreCreateWindow(CREATESTRUCT& cs) { if (!CStatic::PreCreateWindow(cs)) { return FALSE; } cs.style |= SS_OWNERDRAW; return TRUE; } void CMyStatic::PreSubclassWindow() { CStatic::PreSubclassWindow(); ModifyStyle(0, SS_OWNERDRAW); }
I did both just to make sure. Winspector Spy shows SS_OWNERDRAW style in the window styles, but no call to DrawItem occurs. My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
show yur code where you subclass it.
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
does it make any difference that the control is on a dialogbar and not a dialog? My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
does it make any difference that the control is on a dialogbar and not a dialog? My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
Good question, i remember there are issues with toolbars and messages not getting routed. i think that the solution is to override PreTranslateMessage and handle them ur self. Did you watch messages with spy and see if the frame or dialog is receiving the DRAWITEM for that window? -pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
-
Good question, i remember there are issues with toolbars and messages not getting routed. i think that the solution is to override PreTranslateMessage and handle them ur self. Did you watch messages with spy and see if the frame or dialog is receiving the DRAWITEM for that window? -pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
No WM_DRAWITEM messages to be seen anywhere... not on the frame, not on the dialogbar, and not on the static control itself. Now, I have no clue about this. The static shows SS_OWNERDRAW style though... My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
Good question, i remember there are issues with toolbars and messages not getting routed. i think that the solution is to override PreTranslateMessage and handle them ur self. Did you watch messages with spy and see if the frame or dialog is receiving the DRAWITEM for that window? -pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
i give up. I implemented OnPaint() to draw it. I wanted to draw a focus rect, if the control got input focus, but I do not know how to do it when I draw it on OnPaint(). Any ideas? My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
BOOL CMyStatic::PreCreateWindow(CREATESTRUCT& cs) { if (!CStatic::PreCreateWindow(cs)) { return FALSE; } cs.style |= SS_OWNERDRAW; return TRUE; } void CMyStatic::PreSubclassWindow() { CStatic::PreSubclassWindow(); ModifyStyle(0, SS_OWNERDRAW); }
I did both just to make sure. Winspector Spy shows SS_OWNERDRAW style in the window styles, but no call to DrawItem occurs. My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
-
i give up. I implemented OnPaint() to draw it. I wanted to draw a focus rect, if the control got input focus, but I do not know how to do it when I draw it on OnPaint(). Any ideas? My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
Well i don't believe CStatic get input focus. Perhaps you just need a custom window so derive from CWnd. Then do ur OnPaint handler. For focus rect drawing look at CDC::Draw3dRect/DrawEdge/DrawState Something there should do the trick. -pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
-
... and added the SS_OWNERDRAW style, but I never get a call to DrawItem. Why? :confused: My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
WM_DRAWITEM is not sent to the owner draw control but to the owner window (the dialog it is on) of the control. No need to subclass... Oliver