Color of Labels on a Panel

D

Drew

C#

I made a custom class which extends System.Windows.Forms.Panel

I set the background color of the panel to blue.

Then I stuck a bunch of Labels on the Panel.

I explicity set the Labels to be white with black text.

Everything works fine when I run this on the desktop.

However, when I run this on the device with the Compact Framework,
the labels seem to be inheriting the background color of the panel (blue).

What the heck is wrong?

Thanks,

Drew
 
B

Benjamin Wulfe

Several controls, such as radiobutton and checkbox do not support the
BackColor property and always inherit the BackColor of thier parent.
One solution is to make a custom control that calls DrawString and supports
the BackColor property.

-Ben

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Drew" <[email protected]>
| Subject: Color of Labels on a Panel
| Date: Mon, 18 Aug 2003 14:48:51 -0600
| Lines: 25
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: dnvr36.dslgw1poolh1.dnvr.uswest.net 67.40.150.37
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:31223
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| C#
|
| I made a custom class which extends System.Windows.Forms.Panel
|
| I set the background color of the panel to blue.
|
| Then I stuck a bunch of Labels on the Panel.
|
| I explicity set the Labels to be white with black text.
|
| Everything works fine when I run this on the desktop.
|
| However, when I run this on the device with the Compact Framework,
| the labels seem to be inheriting the background color of the panel (blue).
|
| What the heck is wrong?
|
| Thanks,
|
| Drew
|
|
|
|
|
|
 
B

Benjamin Wulfe

How do you mean that you lost focus? Can you give a more detailed
explanation of what happens?

-Ben

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Drew" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: Color of Labels on a Panel
| Date: Mon, 18 Aug 2003 19:01:40 -0600
| Lines: 74
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: dnvr36.dslgw1poolh1.dnvr.uswest.net 67.40.150.37
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:31265
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Well, thanks for the info, but this is a bit of a hassle.
|
| I went ahead and created my own control, overriding the
| OnPaint method and calling DrawString. It's working
| but it doesn't look so great, yet. lol!
|
| However, once I did this, I lost focus on the main form
| which is really messing up my program. Any idea why
| this is happening? What is the solution?
|
| Drew
|
|
|
|
| | > Several controls, such as radiobutton and checkbox do not support the
| > BackColor property and always inherit the BackColor of thier parent.
| > One solution is to make a custom control that calls DrawString and
| supports
| > the BackColor property.
| >
| > -Ben
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > --------------------
| > | From: "Drew" <[email protected]>
| > | Subject: Color of Labels on a Panel
| > | Date: Mon, 18 Aug 2003 14:48:51 -0600
| > | Lines: 25
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.compactframework
| > | NNTP-Posting-Host: dnvr36.dslgw1poolh1.dnvr.uswest.net 67.40.150.37
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| > microsoft.public.dotnet.framework.compactframework:31223
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
| > |
| > | C#
| > |
| > | I made a custom class which extends System.Windows.Forms.Panel
| > |
| > | I set the background color of the panel to blue.
| > |
| > | Then I stuck a bunch of Labels on the Panel.
| > |
| > | I explicity set the Labels to be white with black text.
| > |
| > | Everything works fine when I run this on the desktop.
| > |
| > | However, when I run this on the device with the Compact Framework,
| > | the labels seem to be inheriting the background color of the panel
| (blue).
| > |
| > | What the heck is wrong?
| > |
| > | Thanks,
| > |
| > | Drew
| > |
| > |
| > |
| > |
| > |
| > |
| >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top