CMainFrame background color
S.A.C. Madrid -- sacmad2@ibm.net
Wednesday, January 15, 1997
Enviroment: NT 3.51 Visual C++ 4.0
I have an application MDI, each documment is a list of shapes. I build a
bitmap with
this list and put it in my View DC. This works well.
The problem arrives when I change from one Document to another, and the
views are maximized. What happen is:
-The first document is turned off.
-The window background color turns wite.
-The second documment is maximized.
This produces a blinking effect when the background of each document is
black or different of white.
I tried to put off this effect overriding the function OnEraseBkgnd of the
CMainFrame class, and oainting this background in black, but dosen=B4t work.
How may I put off this blinking effect when I change of View?
Which memeber function of the Main Frame is the right one?
Thanks.
Pedro.
Jim Lawson Williams -- jimlw@mail.ccur.com.au
Friday, January 17, 1997
[Mini-digest: 3 responses]
At 01:11 PM 15/01/97 GMT, sacmad2@ibm.net wrote:
>Enviroment: NT 3.51 Visual C++ 4.0
>
>I have an application MDI, each documment is a list of shapes. I build a
>bitmap with
>this list and put it in my View DC. This works well.
>The problem arrives when I change from one Document to another, and the
>views are maximized. What happen is:
> -The first document is turned off.
> -The window background color turns wite.
> -The second documment is maximized.
>
>This produces a blinking effect when the background of each document is
>black or different of white.
>I tried to put off this effect overriding the function OnEraseBkgnd of the
>CMainFrame class, and oainting this background in black, but dosen=B4t=
work.
>How may I put off this blinking effect when I change of View?
>Which memeber function of the Main Frame is the right one?
> ^^^^^^^^^^
>Thanks.
>Pedro.
>
G'day!
In short, none! One way to make the background black is
BOOL CMyView::OnEraseBkgnd(CDC* pDC)=20
{=09
//Deal with the background brush:
pDC->SetBkColor((COLORREF)RGB(0,0,0));
//Deal with any text:
pDC->SetBkMode(TRANSPARENT);
}
Regards,
Jim LW
>From the BBC's "Barchester Chronicles":
"I know that ultimately we are not supposed to understand.
But I also know that we must try."
-- the Reverend Septimus Harding, crypt-analyst, clog-dancer, C++ pro=
grammer
-----From: Roma
Hello!
sacmad2@ibm.net wrote:
>
> Enviroment: NT 3.51 Visual C++ 4.0
>
[snip]
> -The first document is turned off.
> -The window background color turns wite.
> -The second documment is maximized.
>
> This produces a blinking effect when the background of each document is
> black or different of white.
> I tried to put off this effect overriding the function OnEraseBkgnd of the
> CMainFrame class, and oainting this background in black, but dosenґt work.
This doesn't work because the entire client area of the CMainFrame
window
is covered with MDI Client window. You have to subclass this MDIClient
window and catch *it's* WM_ERASEBKGND message in order to avoid this
blinking.
You can retrieve the handle of this MDIClient window like this:
1.
In the member of your view class
void CYourView::SomeFunction()
{
...
CWnd *pMDIClient = this->GetParentFrame()->GetParent();
...
}
This code uses the fact that actual parent of the MDI child windows is
MDI Client,
not MainFrame window.
2.
You can also loop through the CMainFrame child windows looking for the
window
with class name "MDIClient"
>
> Thanks.
> Pedro.
HTH
-Roma
-----From: Mike Marshall
You should be more specific, but I'm assuming you mean that you want to =
customized painting
of the MDI client area. There is an MSDN article on this called =
something like "Painting the
MDI Client area" or "Customizing the MDI Client area". This will show =
you exactly how to do what
you want. The article was written for VC++ 1.52, but I've used it on =
32-bit applications and
it's worked fine.
This gist of the article is that you subclass the MDI client window and =
handle the
WM_ERASEBKGND message to customize your MDI client area. Remember, the=20
MDI client window is a _different_ window than the main frame window. =
What you see
behind MDI windows is not the client area of the main frame window, but =
the MDI client
window.
MSDN provides an example app called TANGRAM that demonstrates the =
solution.
If you don't have MSDN contact me and I will send you the sample.
Mike Marshall
----------
From: sacmad2@ibm.net[SMTP:sacmad2@ibm.net]
Sent: Wednesday, January 15, 1997 7:11 AM
To: mfc-l@netcom.com
Subject: CMainFrame background color
Enviroment: NT 3.51 Visual C++ 4.0
I have an application MDI, each documment is a list of shapes. I build a
bitmap with
this list and put it in my View DC. This works well.
The problem arrives when I change from one Document to another, and the
views are maximized. What happen is:
-The first document is turned off.
-The window background color turns wite.
-The second documment is maximized.
This produces a blinking effect when the background of each document is
black or different of white.
I tried to put off this effect overriding the function OnEraseBkgnd of =
the
CMainFrame class, and oainting this background in black, but dosen=B4t =
work.
How may I put off this blinking effect when I change of View?
Which memeber function of the Main Frame is the right one?
Thanks.
Pedro.
| Вернуться в корень Архива
|