Disabled control background color property

  • Thread starter Thread starter RSH
  • Start date Start date
R

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
 
-->
--> 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?
 
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
 
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
 
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
 

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

Back
Top