How to change a color of a group of controls

Hello,

I have the following case - on a massive dialog I have a couple of
group boxes. Basically I am interested in only one of these. It has
got a few controls in it - 3 static texts plus 2 date/time pickers.
When one of the pickers reaches certain date I want everything on in
this group to have yellow background. It looks like this is very
difficult - a groupbox deas not have a interior. Therefore it is
impossible to paint the whole group of controls.

I was trying to first make a huge static text (without a caption) and
then place the control on it. But it looks like this deas not work -
window does not support overlapping controls.

Could someone suggest me a simple solution?

Thanks a lot for help

Pshemek

0
11/2/2007 4:51:35 PM
vc.mfc 33608 articles. 0 followers. Follow

19 Replies
974 Views

Similar Articles

[PageSpeed] 7

<przemyslaw.sliwa@gazeta.pl> ha scritto nel messaggio 
news:1194022295.922847.39480@y42g2000hsy.googlegroups.com...

> I have the following case - on a massive dialog I have a couple of
> group boxes. Basically I am interested in only one of these. It has
> got a few controls in it - 3 static texts plus 2 date/time pickers.
> When one of the pickers reaches certain date I want everything on in
> this group to have yellow background. It looks like this is very
> difficult - a groupbox deas not have a interior. Therefore it is
> impossible to paint the whole group of controls.
[...]
> Could someone suggest me a simple solution?

If you want a *simple* solution, I think you may consider WinForm (you can 
use WinForm also from C++, i.e. C++/CLI extensions for .NET managed 
development). I've not tested your particular case, but in general WinForm 
tends to be easier than MFC for things like changing the background of 
controls, etc.

I also think that since Visual C++ 2005 you can integrate WinForms into MFC 
and vice-versa.

Recently Joe wrote an essay about changing dialog-box background colors. I'm 
not sure, but you may find some information and advice that Joe wrote in his 
essay to be interesting also for your problem:

  http://www.flounder.com/dialog_box_color.htm

Moreover, there is a custom group-box control here on CodeProject, of which 
it seems that you can change the background color:

  http://www.codeproject.com/miscctrl/xpgroupbox.asp

Giovanni


0
11/2/2007 5:26:49 PM
It is actually trivial, because a group box, like any other object drawn on a dialog, DOES
HAVE an "interior".  By definition, anything inside its rectangle is the "interior".

The controls have to paint themselves, as all controls would.  You would have to subclass
them and figure out how to set the color for the date-time picker.  Note that the group
box does not draw the backgrounds; the controls draw their OWN backgrounds, and you would
have to inform each control in the group that it should draw itself with another color.
For CStatic is this trivial, you could even set it up to use the reflected =WM_CTLCOLOR
and return a yellow brush; for the date-time picker (a control I rarely use) I'm not sure
what you do.

To set this up you might do something like

void CMyDIalog::HighlightControls(CButton & groupbox, BOOL active)
   {
    CRect r;
    groupbox.GetWindowRect(&r);
    ScreenToClient(&r);
    for(CWnd * wnd = GetWindow(GW_CHILD); wnd != NULL; wnd = wnd->GetWindow(GW_HWNDNEXT))
       { /* scan windows */
        CRect w;
        wnd->GetWindowRect(&w);
        ScreenToClient(&w);
        if(r.PtInRect(w.left, w.top))
            wnd->SendMessage(UWM_SET_ACTIVE, (WPARAM)active);
     } /* scan windows */
   }

Now the user-defined message UWM_SET_ACTIVE is understood by the subclasses you have
written, and when received it changes the color based on the WPARAM value to either the
"active" or "inactive" color.  Note that because I use SendMessage I don't even care about
the nature of the window; if it can handle the message, it does what is appropriate and if
it can't, it doesn't.  I prefer to use Registered Window Messages for this purpose.  You
might use WM_APP but you should avoid WM_USER messages since many controls actually
already use those for their own purposes.
					joe

On Fri, 02 Nov 2007 09:51:35 -0700, przemyslaw.sliwa@gazeta.pl wrote:

>Hello,
>
>I have the following case - on a massive dialog I have a couple of
>group boxes. Basically I am interested in only one of these. It has
>got a few controls in it - 3 static texts plus 2 date/time pickers.
>When one of the pickers reaches certain date I want everything on in
>this group to have yellow background. It looks like this is very
>difficult - a groupbox deas not have a interior. Therefore it is
>impossible to paint the whole group of controls.
>
>I was trying to first make a huge static text (without a caption) and
>then place the control on it. But it looks like this deas not work -
>window does not support overlapping controls.
>
>Could someone suggest me a simple solution?
>
>Thanks a lot for help
>
>Pshemek
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/2/2007 8:24:34 PM
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
news:bc1ni31aorjqbt5h70t4tq9lb550hav9v1@4ax.com...
> It is actually trivial,
  [... several details cut...]
>
> To set this up you might do something like
>
> void CMyDIalog::HighlightControls(CButton & groupbox, BOOL active)
>   {
>    CRect r;
>    groupbox.GetWindowRect(&r);
>    ScreenToClient(&r);
>    for(CWnd * wnd = GetWindow(GW_CHILD); wnd != NULL; wnd = 
> wnd->GetWindow(GW_HWNDNEXT))
>       { /* scan windows */
>        CRect w;
>        wnd->GetWindowRect(&w);
>        ScreenToClient(&w);
>        if(r.PtInRect(w.left, w.top))
>            wnd->SendMessage(UWM_SET_ACTIVE, (WPARAM)active);
>     } /* scan windows */
>   }

Joe: please compare your code with the following WinForm code:

<code>
  //
  // There are two buttons: button1 and button 2.
  // Handle buttons' Click event,
  // and change group-box color accordingly
  //

  private void button1_Click(object sender, EventArgs e)
  {
      groupBox1.BackColor = Color.AliceBlue;
  }

  private void button2_Click(object sender, EventArgs e)
  {
      groupBox1.BackColor = Color.DarkSeaGreen;
  }

</code>

Frankly speaking, I think that .NET WinForm code is *actually trivial* :)
....Don't you agree?

It's just a property set:

    groupBox.BackColor = <...the color...>;

I would very much like MFC to be upgraded to meet the level of programmer 
friendliness and productivity of WinForm...
I belive it is very possible!

Giovanni


0
11/2/2007 10:02:26 PM
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
news:bc1ni31aorjqbt5h70t4tq9lb550hav9v1@4ax.com...
> It is actually trivial,

Joe: moreover, when you say "trivial", please don't consider the perspective 
of a guru programmer like you or others, but try to put in perspective of a 
more "average" programmer.

IMHO, handling WM_CTLCOLOR, etc. are things than can be easy to a good MFC 
programmer, but I think that these kind of things and techniques are not 
very trivial, at least not as trivial as setting a property value as done in 
WinForm.

Giovanni


0
11/2/2007 10:09:28 PM
> 
> Frankly speaking, I think that .NET WinForm code is *actually trivial* :)
> ...Don't you agree?

Without any doubt.


---
Ajay

0
ajaykalra (6842)
11/3/2007 12:53:54 AM
Ohh, com on! do not want to use this crap, WinForms, C# etc.
I have a dependency on about 30 different static libs, do not want to
rebuild them all.
Not a quick solution for me.

On Nov 2, 5:26 pm, "Giovanni Dicanio" <giovanni.dica...@invalid.it>
wrote:
> <przemyslaw.sl...@gazeta.pl> ha scritto nel messaggionews:1194022295.922847.39480@y42g2000hsy.googlegroups.com...
>
>
>
> > I have the following case - on a massive dialog I have a couple of
> > group boxes. Basically I am interested in only one of these. It has
> > got a few controls in it - 3 static texts plus 2 date/time pickers.
> > When one of the pickers reaches certain date I want everything on in
> > this group to have yellow background. It looks like this is very
> > difficult - a groupbox deas not have a interior. Therefore it is
> > impossible to paint the whole group of controls.
> [...]
> > Could someone suggest me a simple solution?
>
> If you want a *simple* solution, I think you may consider WinForm (you can
> use WinForm also from C++, i.e. C++/CLI extensions for .NET managed
> development). I've not tested your particular case, but in general WinForm
> tends to be easier than MFC for things like changing the background of
> controls, etc.
>
> I also think that since Visual C++ 2005 you can integrate WinForms into MFC
> and vice-versa.
>
> Recently Joe wrote an essay about changing dialog-box background colors. I'm
> not sure, but you may find some information and advice that Joe wrote in his
> essay to be interesting also for your problem:
>
>  http://www.flounder.com/dialog_box_color.htm
>
> Moreover, there is a custom group-box control here on CodeProject, of which
> it seems that you can change the background color:
>
>  http://www.codeproject.com/miscctrl/xpgroupbox.asp
>
> Giovanni


0
11/3/2007 3:36:56 PM
Thanks for you reply,

I do not get it - what do you mean the controls will have to draw
thier own background? The gropbox is big, and there is a plenty of
space outside the static text, this is my main problem - the groupbox
is just the frame plus  the background below the title of the
groupbox.

So the controls inside the groupbox have the correct background -
yellow, but a lot of space around them is simply gray (system color).
This looks really ugly and I couldn't find anything on the net which
will fix it. This should be actually a quite simple thing for MFC to
do. But it looks it is not.

Pshemek

On Nov 2, 8:24 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> It is actually trivial, because a group box, like any other object drawn on a dialog, DOES
> HAVE an "interior".  By definition, anything inside its rectangle is the "interior".
>
> The controls have to paint themselves, as all controls would.  You would have to subclass
> them and figure out how to set the color for the date-time picker.  Note that the group
> box does not draw the backgrounds; the controls draw their OWN backgrounds, and you would
> have to inform each control in the group that it should draw itself with another color.
> For CStatic is this trivial, you could even set it up to use the reflected =WM_CTLCOLOR
> and return a yellow brush; for the date-time picker (a control I rarely use) I'm not sure
> what you do.
>
> To set this up you might do something like
>
> void CMyDIalog::HighlightControls(CButton & groupbox, BOOL active)
>    {
>     CRect r;
>     groupbox.GetWindowRect(&r);
>     ScreenToClient(&r);
>     for(CWnd * wnd = GetWindow(GW_CHILD); wnd != NULL; wnd = wnd->GetWindow(GW_HWNDNEXT))
>        { /* scan windows */
>         CRect w;
>         wnd->GetWindowRect(&w);
>         ScreenToClient(&w);
>         if(r.PtInRect(w.left, w.top))
>             wnd->SendMessage(UWM_SET_ACTIVE, (WPARAM)active);
>      } /* scan windows */
>    }
>
> Now the user-defined message UWM_SET_ACTIVE is understood by the subclasses you have
> written, and when received it changes the color based on the WPARAM value to either the
> "active" or "inactive" color.  Note that because I use SendMessage I don't even care about
> the nature of the window; if it can handle the message, it does what is appropriate and if
> it can't, it doesn't.  I prefer to use Registered Window Messages for this purpose.  You
> might use WM_APP but you should avoid WM_USER messages since many controls actually
> already use those for their own purposes.
>                                         joe
>
>
>
> On Fri, 02 Nov 2007 09:51:35 -0700, przemyslaw.sl...@gazeta.pl wrote:
> >Hello,
>
> >I have the following case - on a massive dialog I have a couple of
> >group boxes. Basically I am interested in only one of these. It has
> >got a few controls in it - 3 static texts plus 2 date/time pickers.
> >When one of the pickers reaches certain date I want everything on in
> >this group to have yellow background. It looks like this is very
> >difficult - a groupbox deas not have a interior. Therefore it is
> >impossible to paint the whole group of controls.
>
> >I was trying to first make a huge static text (without a caption) and
> >then place the control on it. But it looks like this deas not work -
> >window does not support overlapping controls.
>
> >Could someone suggest me a simple solution?
>
> >Thanks a lot for help
>
> >Pshemek
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm


0
11/3/2007 3:46:20 PM
<przemyslaw.sliwa@gazeta.pl> ha scritto nel messaggio 
news:1194104216.789027.320630@y42g2000hsy.googlegroups.com...
> Ohh, com on! do not want to use this crap, WinForms, C# etc.

I beg to completely differ.
I belive that .NET, C# and WinForm are examples of modern high quality 
software technologies developed by Microsoft.

And, as I wrote in my previous post, you can use .NET and WinForm also from 
C++/CLI.
(You don't need to port all your codebase to C#.)

Giovanni


0
11/3/2007 4:57:09 PM
Thanks for reply,

just take a look

http://blogs.msdn.com/somasegar/archive/2007/08/08/visual-c-futures.aspx


On Nov 3, 4:57 pm, "Giovanni Dicanio" <giovanni.dica...@invalid.it>
wrote:
> <przemyslaw.sl...@gazeta.pl> ha scritto nel messaggionews:1194104216.789027.320630@y42g2000hsy.googlegroups.com...
>
> > Ohh, com on! do not want to use this crap, WinForms, C# etc.
>
> I beg to completely differ.
> I belive that .NET, C# and WinForm are examples of modern high quality
> software technologies developed by Microsoft.
>
> And, as I wrote in my previous post, you can use .NET and WinForm also from
> C++/CLI.
> (You don't need to port all your codebase to C#.)
>
> Giovanni


0
11/3/2007 7:55:43 PM
That will still introduce dependency on .Net. Not a wise move if all  you 
want is ease in coloring of controls. IMO, OP should stay unmanaged if ease 
of coloring is desired.

---
Ajay

"Giovanni Dicanio" <giovanni.dicanio@invalid.it> wrote in message 
news:utA1nqjHIHA.4684@TK2MSFTNGP06.phx.gbl...
>
> <przemyslaw.sliwa@gazeta.pl> ha scritto nel messaggio 
> news:1194104216.789027.320630@y42g2000hsy.googlegroups.com...
>> Ohh, com on! do not want to use this crap, WinForms, C# etc.
>
> I beg to completely differ.
> I belive that .NET, C# and WinForm are examples of modern high quality 
> software technologies developed by Microsoft.
>
> And, as I wrote in my previous post, you can use .NET and WinForm also 
> from C++/CLI.
> (You don't need to port all your codebase to C#.)
>
> Giovanni
>
> 

0
ajaykalra (6842)
11/3/2007 8:17:00 PM
Deos anyone have an idea how to solve this problem?

Thanks for help

On Nov 3, 8:17 pm, "Ajay Kalra" <ajayka...@yahoo.com> wrote:
> That will still introduce dependency on .Net. Not a wise move if all  you
> want is ease in coloring of controls. IMO, OP should stay unmanaged if ease
> of coloring is desired.
>
> ---
> Ajay
>
> "Giovanni Dicanio" <giovanni.dica...@invalid.it> wrote in message
>
> news:utA1nqjHIHA.4684@TK2MSFTNGP06.phx.gbl...
>
>
>
> > <przemyslaw.sl...@gazeta.pl> ha scritto nel messaggio
> >news:1194104216.789027.320630@y42g2000hsy.googlegroups.com...
> >> Ohh, com on! do not want to use this crap, WinForms, C# etc.
>
> > I beg to completely differ.
> > I belive that .NET, C# and WinForm are examples of modern high quality
> > software technologies developed by Microsoft.
>
> > And, as I wrote in my previous post, you can use .NET and WinForm also
> > from C++/CLI.
> > (You don't need to port all your codebase to C#.)
>
> > Giovanni


0
11/3/2007 10:53:28 PM
"Ajay Kalra" <ajaykalra@yahoo.com> ha scritto nel messaggio 
news:D2F60807-447D-48ED-ABAF-6F8CC495E1EC@microsoft.com...
> That will still introduce dependency on .Net. Not a wise move if all  you 
> want is ease in coloring of controls.

I agree.

Of course, the OP knows better than me what his requirements and needs are.
If he does not want dependency on .NET, he must not use WinForm (or other 
..NET technologies).

I just think that GUI development with WinForm is much simpler than 
*current* MFC (and I also believe that MFC could improve a lot in this kind 
of things, like setting background colors, etc.; this could be a ToDo for 
next versions of MFC... I believe that we can have the easy of use of 
WinForm also in *un*managed environments, in native C++; just some 
improvements to libraries like MFC are required. ).

Giovanni


0
11/3/2007 10:53:45 PM
<przemyslaw.sliwa@gazeta.pl> ha scritto nel messaggio 
news:1194130408.660335.304120@22g2000hsm.googlegroups.com...
> Deos anyone have an idea how to solve this problem?

If you want to stay unmanaged, you may try with Joe's suggestion and the 
CodeProject article I posted...

Giovanni



0
11/3/2007 11:01:18 PM
<przemyslaw.sliwa@gazeta.pl> wrote in message 
news:1194130408.660335.304120@22g2000hsm.googlegroups.com...
> Deos anyone have an idea how to solve this problem?
>


Joe has already given you the advice. This is not a big issue.

---
Ajay

0
ajaykalra (6842)
11/4/2007 2:42:08 PM
The code from CodeProject works fine.



On Nov 4, 2:42 pm, "Ajay Kalra" <ajayka...@yahoo.com> wrote:
> <przemyslaw.sl...@gazeta.pl> wrote in message
>
> news:1194130408.660335.304120@22g2000hsm.googlegroups.com...
>
> > Deos anyone have an idea how to solve this problem?
>
> Joe has already given you the advice. This is not a big issue.
>
> ---
> Ajay


0
11/4/2007 7:00:14 PM
If this were a WinForms newsgroup, with a WinForms problem, then yes, the comparison is
apt.  But the question was how to do it in MFC, so a WinForms answer is sort of like a VB
answer: interesting, clearly shorter, but does it solve the problem?  No, it does not.
					joe

On Fri, 2 Nov 2007 23:02:26 +0100, "Giovanni Dicanio" <giovanni.dicanio@invalid.it> wrote:

>
>"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
>news:bc1ni31aorjqbt5h70t4tq9lb550hav9v1@4ax.com...
>> It is actually trivial,
>  [... several details cut...]
>>
>> To set this up you might do something like
>>
>> void CMyDIalog::HighlightControls(CButton & groupbox, BOOL active)
>>   {
>>    CRect r;
>>    groupbox.GetWindowRect(&r);
>>    ScreenToClient(&r);
>>    for(CWnd * wnd = GetWindow(GW_CHILD); wnd != NULL; wnd = 
>> wnd->GetWindow(GW_HWNDNEXT))
>>       { /* scan windows */
>>        CRect w;
>>        wnd->GetWindowRect(&w);
>>        ScreenToClient(&w);
>>        if(r.PtInRect(w.left, w.top))
>>            wnd->SendMessage(UWM_SET_ACTIVE, (WPARAM)active);
>>     } /* scan windows */
>>   }
>
>Joe: please compare your code with the following WinForm code:
>
><code>
>  //
>  // There are two buttons: button1 and button 2.
>  // Handle buttons' Click event,
>  // and change group-box color accordingly
>  //
>
>  private void button1_Click(object sender, EventArgs e)
>  {
>      groupBox1.BackColor = Color.AliceBlue;
>  }
>
>  private void button2_Click(object sender, EventArgs e)
>  {
>      groupBox1.BackColor = Color.DarkSeaGreen;
>  }
>
></code>
>
>Frankly speaking, I think that .NET WinForm code is *actually trivial* :)
>...Don't you agree?
>
>It's just a property set:
>
>    groupBox.BackColor = <...the color...>;
>
>I would very much like MFC to be upgraded to meet the level of programmer 
>friendliness and productivity of WinForm...
>I belive it is very possible!
>
>Giovanni
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/4/2007 7:16:33 PM
Once you have seen one =WM_CTLCOLOR handler, the problem is trivial, since all problems
look the same.  

But when did this turn into a WinForms newsgroup?
				joe

On Fri, 2 Nov 2007 23:09:28 +0100, "Giovanni Dicanio" <giovanni.dicanio@invalid.it> wrote:

>
>"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio 
>news:bc1ni31aorjqbt5h70t4tq9lb550hav9v1@4ax.com...
>> It is actually trivial,
>
>Joe: moreover, when you say "trivial", please don't consider the perspective 
>of a guru programmer like you or others, but try to put in perspective of a 
>more "average" programmer.
>
>IMHO, handling WM_CTLCOLOR, etc. are things than can be easy to a good MFC 
>programmer, but I think that these kind of things and techniques are not 
>very trivial, at least not as trivial as setting a property value as done in 
>WinForm.
>
>Giovanni
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/4/2007 7:17:34 PM
The group box will also have to draw itself.  This is harder, because you need to handle
the WM_ERASEBKGND message.  You probably also have to handle the reflected WM_CTLCOLOR
handler.
				joe

On Sat, 03 Nov 2007 08:46:20 -0700, przemyslaw.sliwa@gazeta.pl wrote:

>Thanks for you reply,
>
>I do not get it - what do you mean the controls will have to draw
>thier own background? The gropbox is big, and there is a plenty of
>space outside the static text, this is my main problem - the groupbox
>is just the frame plus  the background below the title of the
>groupbox.
>
>So the controls inside the groupbox have the correct background -
>yellow, but a lot of space around them is simply gray (system color).
>This looks really ugly and I couldn't find anything on the net which
>will fix it. This should be actually a quite simple thing for MFC to
>do. But it looks it is not.
>
>Pshemek
>
>On Nov 2, 8:24 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
>> It is actually trivial, because a group box, like any other object drawn on a dialog, DOES
>> HAVE an "interior".  By definition, anything inside its rectangle is the "interior".
>>
>> The controls have to paint themselves, as all controls would.  You would have to subclass
>> them and figure out how to set the color for the date-time picker.  Note that the group
>> box does not draw the backgrounds; the controls draw their OWN backgrounds, and you would
>> have to inform each control in the group that it should draw itself with another color.
>> For CStatic is this trivial, you could even set it up to use the reflected =WM_CTLCOLOR
>> and return a yellow brush; for the date-time picker (a control I rarely use) I'm not sure
>> what you do.
>>
>> To set this up you might do something like
>>
>> void CMyDIalog::HighlightControls(CButton & groupbox, BOOL active)
>>    {
>>     CRect r;
>>     groupbox.GetWindowRect(&r);
>>     ScreenToClient(&r);
>>     for(CWnd * wnd = GetWindow(GW_CHILD); wnd != NULL; wnd = wnd->GetWindow(GW_HWNDNEXT))
>>        { /* scan windows */
>>         CRect w;
>>         wnd->GetWindowRect(&w);
>>         ScreenToClient(&w);
>>         if(r.PtInRect(w.left, w.top))
>>             wnd->SendMessage(UWM_SET_ACTIVE, (WPARAM)active);
>>      } /* scan windows */
>>    }
>>
>> Now the user-defined message UWM_SET_ACTIVE is understood by the subclasses you have
>> written, and when received it changes the color based on the WPARAM value to either the
>> "active" or "inactive" color.  Note that because I use SendMessage I don't even care about
>> the nature of the window; if it can handle the message, it does what is appropriate and if
>> it can't, it doesn't.  I prefer to use Registered Window Messages for this purpose.  You
>> might use WM_APP but you should avoid WM_USER messages since many controls actually
>> already use those for their own purposes.
>>                                         joe
>>
>>
>>
>> On Fri, 02 Nov 2007 09:51:35 -0700, przemyslaw.sl...@gazeta.pl wrote:
>> >Hello,
>>
>> >I have the following case - on a massive dialog I have a couple of
>> >group boxes. Basically I am interested in only one of these. It has
>> >got a few controls in it - 3 static texts plus 2 date/time pickers.
>> >When one of the pickers reaches certain date I want everything on in
>> >this group to have yellow background. It looks like this is very
>> >difficult - a groupbox deas not have a interior. Therefore it is
>> >impossible to paint the whole group of controls.
>>
>> >I was trying to first make a huge static text (without a caption) and
>> >then place the control on it. But it looks like this deas not work -
>> >window does not support overlapping controls.
>>
>> >Could someone suggest me a simple solution?
>>
>> >Thanks a lot for help
>>
>> >Pshemek
>>
>> Joseph M. Newcomer [MVP]
>> email: newco...@flounder.com
>> Web:http://www.flounder.com
>> MVP Tips:http://www.flounder.com/mvp_tips.htm
>
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/4/2007 7:18:48 PM
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:3l6si31l56qpa7fsjsahj0vs1mmtmgth68@4ax.com...
> Once you have seen one =WM_CTLCOLOR handler, the problem is trivial, since 
> all problems
> look the same.
>

I wouldn't claim this.  In the WM_CTLCOLOR handler, not only can you return 
the brush, you can also set the DC to transparent bkmode, etc. and do that 
differently for different types of controls.  It's not straightforward to 
determine exactly what behavior will cause what side effects, and I spent 
quite a lot of time customizing this for my particular cases.


> But when did this turn into a WinForms newsgroup?

Ever since VC2005 C++/CLI lets you easily mix MFC with WinForms controls. 
I've not done this yet, but I'm glad the alternative is there.

-- David 


0
dc2983 (3206)
11/4/2007 9:02:05 PM
Reply:

Similar Artilces:

Color fill after converting to pdf
When I fill a text box or auto shape with a solid color, after converting to pdf (primo) it suddenly shows as a type of plaid pattern. I have double, triple and quadruple checked and I have not selected any type of patterns, and all my settings are normal. Working on a recent file that I shared with a friend, her filled boxes are NOT showing this same pattern after converting, only mine. What could be causing this on my program only and what can I do to fix it? Are you certain you are not applying transparency? Is your friend using the same PDF converter? What version Publisher? Mic...

REPOST
Can anyone explain or point me to a link with information on why the MAPI Public Folder tree is "homed" to a specific Admin Group (First)? I am now in Exchange Native mode and it hasn't allowed me to segment the PF hierarchy between admin groups. I am very curious why in 5.5 sites had their own PF hierarchies but Admin Groups now do not. I had planned on multiple Admin Groups managing their own MAPI public folders so this throws a serious monkey wrench in the admin delegation design. Any advice/help is much appreciated! ...

Change Bussines Unit
I want to move crm user form one business unit to another. Is it possible to do it in CRM ? Yes, it is possible. Go to user list and from the tool bar select Change business unit... Do not open the users details! Mike "Mark" wrote: > I want to move crm user form one business unit to another. Is it possible to > do it in CRM ? ...

Permissions in AD for ADD/Change/Modify smtp proxy addresses
I have an Accounts Operator group that no longer can add or modify the SMTP Proxy email addresses in user properties. Don't know what happen, but could someone please tell me what specific permissions I need to give them to be able to add/change these addresses in user properties?? Thanks, Dana ...

Can't group by dates in Excel 2003 pivot table
I do not get a Group By dialog box when I select Group. It adds a group name, but puts everything in one big group. If there are text entries, or blank cells in the date column, you won't be able to group the field. If that's the problem, perhaps you could delete any text, and add a "dummy" date to records with no date. barbara1234 wrote: > I do not get a Group By dialog box when I select Group. It adds a group name, > but puts everything in one big group. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html Thanks Debra. ...

Changing the Exchange Orginization Name
I'm trying to mount a mailbox store that was from another domain. After using esutil to clean the db, it still won't mount. The error I get points out that the Distinctive names are different. Event Type: Error Event Source: MSExchangeIS Event Category: General Event ID: 1088 Date: 11/19/2003 Time: 11:10:31 PM User: N/A Computer: MACHINE_A Description: The information store could not be loaded because the distinguished name (DN) /O=ABC CORPORATION/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN= of message database "First Storage Group\Mailbox Store (MACHINE_A)" does not m...

Change color
I've a form on which there is a check box TaskComp and a text box TaskDate. Using the following VBA code, when the check box is checked, the Date in the text box is set to the current date. This works fine. Private Sub TaskComp_AfterUpdate() If TaskComp.Value = -1 Then TaskDate.Value = Date Else TaskDate.Value = Null End Sub I want the background color of the text box to change from whit to red when the check box is echecked, so I added to the code: Private Sub TaskComp_AfterUpdate() If TaskComp.Value = -1 Then TaskDate.Value = Date Else TaskDate.Value = Null If TaskCom...

Urgent help: change outlook default conatct form
Hi all, We added several fields to contacts in the standard form (design mode). We want this form to become users' default conatct form. Also, old contacts are able to launch from this new customized form. are these possible? exchange 2003/outllokk2003/outlook 2007) Yes. This is possible. You need to change the form on the folder properties and then run a program to change the IPM form used on existing items. See the last two sections at http://www.outlook-tips.net/beginner/publish_form.htm for details and link to the program. -- Diane Poremsky [MVP - Outlook] ...

Changing Source excel file causes links in word to fail
I've got a Word document with about 600 links to an excel spreadsheet. Updating the links works fine until the source excel file is changed thenword changes some portion of the links from Unformatted Text to a spreadsheet cell. Changing the links manually or with a macro there are some observed changes in the links. The cells that change are changed from Automatic to Manual and this happens to all of the cells on a single Excel row. There's nothing wrong with the data and the spreadsheet formats are identical. When I go back to the original settings I can change the ...

Change Admin Group
Is anyone aware of a workaround for changing a server from one Administrative Group to another? I know they aren't easily moved looking for a hack if available. Many thanks, Jeff "Jeff Abbott" <jeff.abbott@veritas.com> wrote: >Is anyone aware of a workaround for changing a server from one >Administrative Group to another? I know they aren't easily moved looking >for a hack if available. Moving the server's easy. Making it work after you do it's a bitch. Moving an object between containers with ADSI isn't hard. Getting all the objects renam...

charting a single changing DDE cell
I have a spreadsheet that captures real time stock data via a DDE link. The cell captures the last price of a stock as it changes over time. Can you chart that changing cell as the day progresses. Maybe capture the data and then chart it or a macro which plots that cell every minute? Bob You would need to capture the value of that changing cell periodically in a growing table, possibly in a different sheet. For example, every time you update it via the DDE, you could run a code that copies the value of the cell to the last row of the table. Use a dynamic chart to plot the values in t...

cell font color changes
When i change a cell font to grey in Excel why doesn't it print grey when sent to a black printer. it only prints grey if sent to a color printer hi, Because the B/W printer can only print in black. the color printer can print in colors and to the printer gray is just another color. regards Frank >-----Original Message----- >When i change a cell font to grey in Excel why doesn't it print grey when >sent to a black printer. it only prints grey if sent to a color printer >. > Also, some b/w printers offer a "grayscale" option under Print Qualit or the lik...

Change Exchange Virtual Directory URL
Hi, how can i change the virtual directory in Exchange OWA URL default path is https://servername.domain.tld/exchange for OWA. I would like OWA is available by https://servername.domain.tld/ without /exchange in URL. Is that possible, with minimal administrative effort? Thanks Florian http://support.microsoft.com/kb/293386/en-us. "flabs" <flabs@discussions.microsoft.com> wrote in message news:FB9525E2-9246-43A3-A309-06F6B025D5C4@microsoft.com... > Hi, > > how can i change the virtual directory in Exchange OWA URL > default path is https://servername.domai...

How do I change default file locations in Publisher 2007?
any answers gratefully received! You can't. You can put a folder into My Places, when you save a Publisher document, click on that folder. It is an extra step, the developers forgot to include a default path option. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Jake" <Jake@discussions.microsoft.com> wrote in message news:80F4F34D-FF54-400F-81BE-6388FFA564A4@microsoft.com... > any answers gratefully received! Thanks Mary. LEt's hope it will be added in the future! Best JAke "Mary Sauer"...

Version Control
Hello MOSS Community, I have the following situation with MOSS version control: If I checked out the document using the drop down arrow, the comment box did appear when I checked it in. If I opened the document and then clicked the Edit Document Button from the top of the document (Office 2007 only), the comment box did not appear when I checked it back in. I would expect that the same version control dialog box appear regardles the way I open the file. Your help is very appreciated Thanks in advance Mauricio I ...

Call database property in a control on a form and in my Switchboard variables
I have a database that I have developed for multiple units to use. For reasons that I won't go into, each unit must have an individual copy of the database to store their data. BUT the databases need to be identical. So far, annoying, but no big deal. Anyway, what I am doing is creating the master copy where I get it all correct and then I will make a copy for each unit and drop their data into it... again no big deal. BUT in order to help keep them straight, I would like to have specific labels that refer to the database property Title bc the DB is on a network buried in a file more the...

Rotate a page to change its view in OneNote?
How do i rotate a page to change the view in OneNote? I want to rotate a page 90 degrees from portriat to landscape. -------- Original-Nachricht -------- > How do i rotate a page to change the view in OneNote? I want to rotate a > page 90 degrees from portriat to landscape. There is no ability in ON to rotate a page, even not for pictures. But for pictures/printouts there is a powertoy: http://blogs.msdn.com/johnguin/archive/2007/12/14/image-rotator-powertoy-for-onenote-2007.aspx Bernd ...

OT Closed NNTP Groups Still Available
The first batch of NNTP groups on msnnews.microsoft.com newsservers were closed last Friday. however, they are still available on other NNTP servers such as news.eternal-september.org. I posted to a half dozen or so just to see if they were still there and indeed they are. This confirms there is indeed life for NNTP after MSFT. -- ______________ BullDawg Associate Expert In God We Trust ______________ ...

Word randomly changing my figures and tables captions
I'm trying to format a large document, with over 150 tables and figures in it. I've used captions to label them all, but I'm now finding that Word is randomly changing some that I have specified as 'table' to 'figure' and vice versa. This particularly seems to be happening with tables and figures that appear on the same page, but is not restricted to these instances. As soon as I change one caption back to the correct type, the one below will change itself to the wrong type again! I need the captions to remain as I've entered them for my table of f...

In Project 2007, Group By Baseline Start is Rolling Up Max, not Mi
In Project 2007, when you display the Baseline Start field in view with grouping turned on, Baseline Start displays the Maximum Baseline Start of the tasks that form the group, not the minimum. To work around this bug, customize a Start or Date field to equal Baseline Start with Summary calculating rollup minimum. ...

Changing database used with ODBC link
I have a excel spreadsheet containing many (we're talking thousand here!) of cells which look-up information via an ODBC link to our SQ Server database. This database has recently changed, so I need to mak every one of these queries point to a new database in the system Unfortunately the name of the database appears to be hardcoded in t each query. I have tried in vain to do a search and replace in a tex editor on the spreadsheet, but as I feared once I have done this th spreadsheet no longer opens. Is there any way to globally update the queries used? I don't fanc manually updating e...

Change Font
I'm a SharePoint user. Sometimes when I post data into a SharePoint list field, the text appears in a format that differs from the rest of the data on the page. Sometimes it stays in the source format and sometimes it changes to another font that does not match the other cells on the page. How do I change the field fonts in SharePoint? I can find no command for this. The only place I'm aware of where fonts matter in SP fields are in the so-called "multiple line of text" type of field. There you are allowed to define fonts as it's sort of like a mini-w...

how do i change the default number type which is formatted in new.
how do i change the default number type which is formatted in new spreadsheet Create a new workbook Change the Normal style (Format>Styles from the menu) to reflect your preferred number format. You can also change font style and size if your prefer. Save the workbook as a template - choosing File>Save As and select Template under the 'Save As Type' dropdown at the bottom, saving it with the name BOOK.XLT in the directory C:\Program Files\Microsoft Office\Office10\XLStart\ If you have an older or newer version, you may not see the Office10 subdirectory, so adjust as appr...

PO won't allow status change
Hi, we have a po, GP 10, the status is released. I want to cancel it but when we attempt to cancel it tells us we cannot change the status when an item has been received against it. I can't find where to tell what was received. I have tried to receive, receive & inv., match and nothing appears when each process is applied. Help says to remove a PO w/a Released status, close or cancel, but we are unable. Any suggestions? -- P McCarthy You can click on each line item on the PO and them click the Purchasing Quantity Status icon (the i in a circle) to see the detailed informati...

Counting within a group
Hi, In my Summary report, there are two groups: jobNo within Category. jobNo contains data which can be repetative, but not for all records. In other words, there can be: 6 records with jobNo 1234, 2 records with 4567 and 1 record for 9701. I want to count the number of times that jobNo changes, but not the total number of jobNo records. I tried a query using an expression Max(jobNo), then tried to sum it in the report, but it gives the total number for jobNo's. How can I achieve the result I am seeking? Thanks in advance, Jake If you want to list all the records on the repo...