I guess when you specify SS_OWNERDRAW you can't specify any other type. I
can see the logic behind that, a little.
custom draw static controls.
AliR.
none <none@none.none> wrote:
"AliR \(VC++ MVP\)" <AliR@online.nospam> wrote:
Can you post the entire CMyStatic class? It looks like the problem
is in there!
I was hoping that was the case, but I don't think that's possible.
Below is code that reproduces the problem.
[SNIP]
Sonofabitch. I figured out the problem. The SS_* flags are defined as
follows (winuser.h):
#define SS_LEFT 0x00000000L
#define SS_CENTER 0x00000001L
#define SS_RIGHT 0x00000002L
// ...
#define SS_OWNERDRAW 0x0000000DL
// ...
#define SS_TYPEMASK 0x0000001FL
They share the same bitfield! So this is totally invalid:
ModifyStyle(0, SS_OWNERDRAW);
It just happens to work correctly with SS_LEFT and SS_CENTER, but not
SS_RIGHT, because:
0x00000000L | 0x0000000DL == 0x0000000DL
0x00000001L | 0x0000000DL == 0x0000000DL
0x00000002L | 0x0000000DL == 0x0000000FL
A value of 0x0000000F means SS_ENHMETAFILE !!
The ModifyStyle call should look like this:
ModifyStyle(SS_TYPEMASK, SS_OWNERDRAW);
That clears out any existing static-style flags and replaces them with
the SS_OWNERDRAW flag. I just rebuilt and everything works.