Win API programming and transparency, small question left... lazarus / 8-Other ---------------------------------------------------------------------- CCRDude · 2006-07-12 14:35 I'm about to add an example for background images (seems to be typical on WinCE - though this code should work quite the same way on Win32 ) and the necessary transparency on control to my howto blog. Source code of NoFrameworkAppDemo2.lpr Now I've got the effect that while even controls in sub-windows are transparent (I had to introduce child control message procedures in the demo for that), the heading of the group box is stroken through, which looks quite bad: (http://img116.imageshack.us/img116/6638/screenshotv158sf.th.png) Does anyone have an idea on how I could easily draw this heading properly without the line in the background of the text? ---------------------------------------------------------------------- Marc · 2006-07-12 21:49 Use get text extends to retrieve the rectangle of the text then either: don't draw the line in that area or: exclude the textrectregion,  draw the box, restore the region, draw the text. BTW, you don't use a standard wince control for a groupbox ? ---------------------------------------------------------------------- CCRDude · 2006-07-13 16:25 Thank you, I'll play around with your hints I thought this maybe could be done without "tweaking" the standard control by overpainting it, but that's better than nothing What do you mean by standard WinCE control? From what I understood from the SDK, a BUTTON with attribute BS_GROUPBOX set is a standard groupbox? From the SDK: QuoteWindows CE provides four kinds of buttons: check box, push button, radio button, and group box. So I thought that this would be the standard ---------------------------------------------------------------------- Marc · 2006-07-16 22:20 Eh, yes, but hasn't the groupbox a caption ? I would expect that is you set the caption of the groupbox control, windows doesn't draw the line through it (at least it doesn't so on win32) So for your question, I draw the conclusion that you draw the caption yourself. It that is not he case, I would say it is a windows bug. ---------------------------------------------------------------------- CCRDude · 2006-07-17 12:05 No, I didn't draw the caption myself All I do: Code: [Select]FGroupHandle := CreateWindow('BUTTON', 'Demo groupbox', WS_VISIBLE or WS_CHILD or BS_GROUPBOX, 4, 64, rectWindow.Right-8, 64, FWindowHandle, 0, hInstance, nil); I guess in the non-transparent way, 1. Windows draw the group background, 2. then the lines, 3. then the caption background (which over-draws the line where the caption is), 4. then the caption itself. "My" method for transparency uses WM_CTLCOLORSTATIC and WM_ERASEBKGND to simply replace the background (that's where I override the default behaviour)... but probably step 3 from above is missing... I should probably create some kind of debug log, looking which rects are drawn with which handles, to see if I even get a message for step 3 (if not, the background wouldn't be erased and that would be the problem). Will do so right after lunch