If you specify one of the static control styles which draw a frame or rectangle
SS_BLACKRECT |
SS_BLACKFRAME |
SS_GRAYRECT |
SS_GRAYFRAME |
SS_WHITERECT |
SS_WHITEFRAME |
the control will be drawn with the corresponding color (which, as we saw last time, isn’t actually black, gray, or white). If you try to customize the color by handling the WM_CTLCOLORSTATIC
message, you’ll find that it has no effect.
Well, yeah, because you said you wanted a black rectangle.
If you want some other color, you could set the style to SS_OWNERDRAW
then draw the solid color in your WM_DRAWITEM
handler. Or you can just use a text static control with no text. In that case, you can respond to WM_CTLCOLORSTATIC
in the usual way. Since you specified no text, all that will be drawn is the background color.
0 comments