471,319 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Disabled control background color property

RSH

This might be a dumb question but I have searched everywhere...I have a form
which uses a custom background color. I have set the control's backgrounds
to transparent, which works great. But when i disable the controls, they
all have the standard beige Windows background, is there a way to set the
disabled background color too??

Thanks,
Ron
Jan 10 '06 #1
4 3657
On Tue, 10 Jan 2006 14:15:43 -0500, "RSH" <wa*************@yahoo.com>
wrote:

-->
--> This might be a dumb question but I have searched everywhere...I
have a form
--> which uses a custom background color. I have set the control's
backgrounds
--> to transparent, which works great. But when i disable the
controls, they
--> all have the standard beige Windows background, is there a way to
set the
--> disabled background color too??
-->
--> Thanks,
--> Ron
-->
Ron,

Can you just override the OnPaintBackground methods of the controls
you're wanting to be transparent?
Jan 10 '06 #2
RSH

Okay I understand how to override the OnPaintBackground method, but how do I
do it for specific controls?

I tried this:

protected override void OnPaintBackground(PaintEventArgs Pe)

{

comboBox1.BackColor = Color.DarkBlue;

}

But it simply turned the control blue when it was enabled...when I disabled
the control it went back to the normal windows color. Not to mention that
all the other controls and the form itself were transparent (Cool but not
the effect I was after.

Thanks,

Ron



"Michael H" <gf*****@gmail.com> wrote in message
news:7o********************************@4ax.com...
On Tue, 10 Jan 2006 14:15:43 -0500, "RSH" <wa*************@yahoo.com>
wrote:

-->
--> This might be a dumb question but I have searched everywhere...I
have a form
--> which uses a custom background color. I have set the control's
backgrounds
--> to transparent, which works great. But when i disable the
controls, they
--> all have the standard beige Windows background, is there a way to
set the
--> disabled background color too??
-->
--> Thanks,
--> Ron
-->
Ron,

Can you just override the OnPaintBackground methods of the controls
you're wanting to be transparent?

Jan 11 '06 #3
Ron,

Have you tried to create a custom Control that inherits from the
Control you want to add onto your Form? It's in this custom Control
where you would override the OnPaintBackground, not on the Form
itself.

Michael
Jan 12 '06 #4
RSH
What would the code look like to do this?

I have tried doing this but it doesn't matter when I click on a button that
sets the control's Enable property to false it still sets the color to the
normal Windows background color which looks really bad on a a gradated grey
background.

Thanks,
Ron
"Michael H" <gf*****@gmail.com> wrote in message
news:ug********************************@4ax.com...
Ron,

Have you tried to create a custom Control that inherits from the
Control you want to add onto your Form? It's in this custom Control
where you would override the OnPaintBackground, not on the Form
itself.

Michael

Jan 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Skip Borland | last post: by
5 posts views Thread by Mark Hannon | last post: by
3 posts views Thread by Kelly Domalik | last post: by
3 posts views Thread by Steve Le Monnier | last post: by
2 posts views Thread by James Ramaley | last post: by
reply views Thread by sunny076 | last post: by
2 posts views Thread by =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= | last post: by
6 posts views Thread by =?Utf-8?B?Sm9obiBBdXN0aW4=?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.