15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dialog Bar Background Color

ahofmann@ndc.co.il
Tuesday, April 01, 1997

     Environment: MSVC++ 4.2b, Windows 95
     
     Hi there!
     
     I hava an SDI App with a number of dialog bars which appear and 
     disappear depending on menu choices. Basically, the control bars fill 
     the "client area" of the app so it looks like a dialog (though the 
     behaiour of the app is not really that of a dialog based app).
     
     All the control bars send their messages to CMainFrame (this done via 
     the ClassWizard).
     
     My problem is that I want to change the background color of just a few 
     of the bars. They will always have this different background (though 
     the bars are not always visible), so I don't need any great "on the 
     fly" flexibility.
     
     I looked in April 96 MSDN (updates haven't arrived yet!) using "Set 
     Background Color Control Bar" and "Changing Background Color MFC".
     
     The possibilities I saw were:
     
     a) SetDialogBkColor() - this is no good as it changes all the Dialogs 
     (for all I know it doesn't even work on Dialog bars, but doesn't seem 
     to be what I want anyway)
     
     b) Trapping WM_ERASEBKGND - overriding OnEraseBkgnd(). But I think 
     this would only work for a separate derived from Dialog bar for those 
     bars, and then their messages won't go to CMainFrame.....
     
     Is there anyway to intercept the WM_ERASEBKGND message in the 
     CMainFrame and tell which Dialog Bar is being repainted? Or even 
     something simpler....?
     
     Thanks for any solutions/code snippets.
     
     Kibi Hofmann
     ahofmann@ndc.co.il



Alan Kleymeyer -- akleymeyer@netspeed.com
Wednesday, April 02, 1997

Does creating child windows containing the dialogbars sound like a
reasonable solution. ? Or would the "background" area you want to change
be part of the child dialogbar?

>----------
>From: 	ahofmann@ndc.co.il[SMTP:ahofmann@ndc.co.il]
>Sent: 	Tuesday, April 01, 1997 9:53 AM
>To: 	mfc-l@netcom.com
>Subject: 	Dialog Bar Background Color
>
>     Environment: MSVC++ 4.2b, Windows 95
>     
>     Hi there!
>     
>     I hava an SDI App with a number of dialog bars which appear and 
>     disappear depending on menu choices. Basically, the control bars fill 
>     the "client area" of the app so it looks like a dialog (though the 
>     behaiour of the app is not really that of a dialog based app).
>     
>     All the control bars send their messages to CMainFrame (this done via 
>     the ClassWizard).
>     
>     My problem is that I want to change the background color of just a few 
>     of the bars. They will always have this different background (though 
>     the bars are not always visible), so I don't need any great "on the 
>     fly" flexibility.
>     
>     I looked in April 96 MSDN (updates haven't arrived yet!) using "Set 
>     Background Color Control Bar" and "Changing Background Color MFC".
>     
>     The possibilities I saw were:
>     
>     a) SetDialogBkColor() - this is no good as it changes all the Dialogs 
>     (for all I know it doesn't even work on Dialog bars, but doesn't seem 
>     to be what I want anyway)
>     
>     b) Trapping WM_ERASEBKGND - overriding OnEraseBkgnd(). But I think 
>     this would only work for a separate derived from Dialog bar for those 
>     bars, and then their messages won't go to CMainFrame.....
>     
>     Is there anyway to intercept the WM_ERASEBKGND message in the 
>     CMainFrame and tell which Dialog Bar is being repainted? Or even 
>     something simpler....?
>     
>     Thanks for any solutions/code snippets.
>     
>     Kibi Hofmann
>     ahofmann@ndc.co.il
>



Claire Rollet -- crollet@sympatico.ca
Wednesday, April 02, 1997

>      b) Trapping WM_ERASEBKGND - overriding OnEraseBkgnd(). But I think=
=20
>      this would only work for a separate derived from Dialog bar for
those=20
>      bars, and then their messages won't go to CMainFrame.....

I really don't see why "their messages won't go to CMainFrame....." ??
Is it a CDialogBarCtrl you're using?=20
If so, there souldn't be any problem (even if you derive your own class!)
You just have to be sure that the parent window is the main window or a
child (... of a child, of a child, ... of a child...) of it.

------------------------------------------------------
Francis Girard
fgirard@machinasapiens.com
----------
> De : ahofmann@ndc.co.il
> A : mfc-l@netcom.com
> Objet : Dialog Bar Background Color
> Date=A0: 1 avril, 1997 10:53
>=20
>      Environment: MSVC++ 4.2b, Windows 95
>     =20
>      Hi there!
>     =20
>      I hava an SDI App with a number of dialog bars which appear and=20
>      disappear depending on menu choices. Basically, the control bars
fill=20
>      the "client area" of the app so it looks like a dialog (though the=
=20
>      behaiour of the app is not really that of a dialog based app).
>     =20
>      All the control bars send their messages to CMainFrame (this done
via=20
>      the ClassWizard).
>     =20
>      My problem is that I want to change the background color of just a
few=20
>      of the bars. They will always have this different background (thou=
gh

>      the bars are not always visible), so I don't need any great "on th=
e=20
>      fly" flexibility.
>     =20
>      I looked in April 96 MSDN (updates haven't arrived yet!) using "Se=
t=20
>      Background Color Control Bar" and "Changing Background Color MFC".
>     =20
>      The possibilities I saw were:
>     =20
>      a) SetDialogBkColor() - this is no good as it changes all the
Dialogs=20
>      (for all I know it doesn't even work on Dialog bars, but doesn't
seem=20
>      to be what I want anyway)
>     =20
>     =20
>      Is there anyway to intercept the WM_ERASEBKGND message in the=20
>      CMainFrame and tell which Dialog Bar is being repainted? Or even=20
>      something simpler....?
>     =20
>      Thanks for any solutions/code snippets.
>     =20
>      Kibi Hofmann
>      ahofmann@ndc.co.il




Become an MFC-L member | Вернуться в корень Архива |