Why are my windows transparent?
Hi All,
I have several possible related problems, all of them having to do with controls dissapearing and or drawing improperly.
1)
First, I have a modeless dialog box that draws everything underneath it. It still has a frame and everything
here is the .rc file:
Code:
IDD_GAL_SAVE DIALOGEX 0, 0, 316, 333
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU |WS_VISIBLE
CAPTION "Gallery Information"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,106,312,50,14
PUSHBUTTON "Cancel",IDCANCEL,160,312,50,14
CONTROL "",IDC_SGAL_PREV,"Static",SS_BITMAP | SS_CENTERIMAGE| SS_REALSIZEIMAGE ,181,20,100,100
PUSHBUTTON "Take Screenshot...",IDC_SGAL_SHOT,216,126,85,14
EDITTEXT IDC_SGAL_DESCR,16,23,141,272,ES_AUTOHSCROLL
COMBOBOX IDC_SGAL_APPSEL,181,164,117,150,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Description",IDC_SGAL_INFO,7,7,159,297
GROUPBOX "Preview Image",IDC_SGAL_PICS,170,7,139,138
GROUPBOX "Applications",IDC_SGAL_APP,171,151,138,155
END
I have tried using WM_ctlcolordlg and wm_ctlcolorstatic, etc. and tried setting background mode and color to the default 3D face brush color, however nothing paints it in....
2)
I have a tab control that has a dialog box (no sys_menu or frame, just a gray box) that occupies the display area of each tab page. Each tab click hides the other page and shows the other. After each click, the group static controls all draw items from the previously displayed dialog box within them.
3) I have a toolbox control that utilizes an image list attached to the frame window (i am using an mdi architecture), but the toolbox will dissapear randomly, and i have to drag another window over it for it to show again...
I have created many many dialog boxes in my application but only these windows are giving me trouble for some reason. I feel like it may have something to do with the static group box controls...
Thanks for any help!
Re: Why are my windows transparent?
Quote:
I feel like it may have something to do with the static group box controls...
Well, and I believe that's something to do with your dialog/window procedure(s).
Quote:
I have tried using WM_ctlcolordlg and wm_ctlcolorstatic, etc. and tried setting background mode and color to the default 3D face brush color, however nothing paints it in....
What this info has to do with your problem?
Re: Why are my windows transparent?
Quote:
Originally Posted by
kingting
I have a tab control that has a dialog box (no sys_menu or frame, just a gray box) that occupies the display area of each tab page. Each tab click hides the other page and shows the other.
What is your "tab pages"? Dialogs or something else?
Re: Why are my windows transparent?
the pages of the tab display are dialog boxes.
By "paints" I actually meant that using SetBkMode(), SetBkColor(), FillRect(), returning the hbrush that is the COLOR_3DFACE does not work for any of them
Re: Why are my windows transparent?
SetBkMode() does not require a brush but a keyword (OPAQUE or TRANSPARENT)
SetBkCorlor() does not use a brush but a colorreference
Don't know about your call to FillRect() though.
Norbert
Re: Why are my windows transparent?
Actually I just fixed these issues, but the toolbar redrawing issue remains. Do I have to subclass the toolbar control?
Re: Why are my windows transparent?
Quote:
Originally Posted by
gummibaer
Don't know about your call to FillRect() though.
FillRect API does use HBRUSH, however in most cases it could be a temp brush as in MSDN example
Code:
FillRect(hdc, &rect, (HBRUSH) (COLOR_WINDOW+1));
Re: Why are my windows transparent?
Thanks Victor.
Kingting:
When you hide your control and uncover it again, then your dialogprocedure receives a WM_PAINT-message. Apparently this is what you must create on your own. Seems you should include a call to InvalidateRect (..).
Norbert
Re: Why are my windows transparent?
I fill the rectangle of the group box in my WM_PAINT message, however only the small static text (the group label) gets filled in with the brush. My tool bars constantly lose the back gray color as well, yet the buttons remain floating there.
Thanks for all the help!
Re: Why are my windows transparent?
Quote:
Originally Posted by
kingting
I fill the rectangle of the group box in my WM_PAINT message, however only the small static text (the group label) gets filled in with the brush.
how do you fill it? Could you show your code?
Re: Why are my windows transparent?
Code:
case WM_PAINT:
{
HDC hdc = GetDC(hwnd);
RECT rect;
GetWindowRect(GetDlgItem(hwnd, ID_SM_SKETCH),&rect);
FillRect(hdc, &rect, CreateSolidBrush(GetSysColor(COLOR_3DFACE)));
ReleaseDC(hwnd,hdc);
return FALSE;
}
break;
Re: Why are my windows transparent?
Incorrect!
You have to use BeginPaint to get the HDC, not the GetDC.
Re: Why are my windows transparent?
The two do not do the same thing?
I will try this. Thanks!
Re: Why are my windows transparent?
Hello everybody, I fixed the painting problem. However, my toolbar that I created keeps dissapearing whenever a window passes over it, and it requires me to minimize and restore the window for it to show up again. Any clues?
Re: Why are my windows transparent?
Quote:
Originally Posted by
kingting
my toolbar that I created keeps dissapearing
Toolbar or "toolbox"?
How did you create it?
What type of application are you using?