Greetings fellow coders, I just made a bitmap as background in my dialogbox and after running my prog I realized that the Static text in my Dialog appears in ugly grey boxes... For the question: (I bet you know already) How do I remove this ugly grey from my text? Thanks a lot, JimmyClif (As usual I used BRW for my rescource file (again))
I think there is a transparent option for text (look in windows.inc, it may be near SS_LEFT)
One way is to respond to WM_CTLCOLORSTATIC. Something like ; (assume wndproc has arguments named hWnd, iMsg, wParam, ; and lParam) ; ; This makes the background color behind each character ; transparent. wParam is the hDC of the static control invoke SetBkMode,wParam,TRANSPARENT ; invoke GetStockObject,NULL_BRUSH ; The return value, in EAX, from the above call is ; passed back, in EAX, to the code that called the ; wndproc or dlgproc. (This is one of about a dozen ; cases where the dlgproc doesn't return TRUE/FALSE.) ; This return value is the background brush for ; the part of the control that doesn't have text ; in it (the trailing space).
Thanks for the quick answers... That did it. Before I posted I tried already responding to the WM_CTLCOLORSTATIC but I was using SetBkColor which did absolutely nothing, same as SetTextColor. Why don't they work?
Got it... After the WM_CTLCOLORSTATIC I *must* return a valid brush... I love it when a plan comes together :)
It's quite easy actually. In your resource file you'll have something like this already: LTEXT "MyText",IDC_STATIC,10,40,45,10 Now you need to append an ",WS_EX_TRANSPARENT" to the line like this: LTEXT "MyText",IDC_STATIC,10,40,45,10,WS_EX_TRANSPARENT Now it will be tranpsparent! Have fun! See ya, Ben