If you specify one of the static control styles which draw a frame or rectangle


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_CTL­COLOR­STATIC 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_OWNER­DRAW then draw the solid color in your WM_DRAW­ITEM handler. Or you can just use a text static control with no text. In that case, you can respond to WM_CTL­COLOR­STATIC in the usual way. Since you specified no text, all that will be drawn is the background color.