-
May 7th, 2012, 05:09 PM
#1
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!
-
May 8th, 2012, 01:10 AM
#2
Re: Why are my windows transparent?
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).
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?
Best regards,
Igor
-
May 8th, 2012, 05:20 AM
#3
Re: Why are my windows transparent?
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?
Last edited by ovidiucucu; May 8th, 2012 at 05:23 AM.
-
May 8th, 2012, 10:16 AM
#4
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
-
May 8th, 2012, 10:48 AM
#5
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
-
May 8th, 2012, 11:07 AM
#6
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?
-
May 8th, 2012, 11:09 AM
#7
Re: Why are my windows transparent?
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));
Victor Nijegorodov
-
May 8th, 2012, 02:46 PM
#8
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
-
May 10th, 2012, 12:55 PM
#9
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!
-
May 10th, 2012, 02:01 PM
#10
Re: Why are my windows transparent?
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?
Victor Nijegorodov
-
May 10th, 2012, 04:10 PM
#11
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;
-
May 10th, 2012, 04:16 PM
#12
Re: Why are my windows transparent?
Incorrect!
You have to use BeginPaint to get the HDC, not the GetDC.
Victor Nijegorodov
-
May 11th, 2012, 10:45 AM
#13
Re: Why are my windows transparent?
The two do not do the same thing?
I will try this. Thanks!
-
June 5th, 2012, 05:31 PM
#14
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?
-
June 6th, 2012, 01:19 AM
#15
Re: Why are my windows transparent?
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?
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|