[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

make a transparent control

João Santa Bárbara

12/15/2004 10:36:00 AM

Hi all
i'm doing a form that i paint on the event onpaint.
And i want to make all controls in that form to become transparent in the
way i can see the form background is it possible how ??

thks
JSB

PS: any sample !!!


5 Answers

Bob Powell

12/16/2004 4:59:00 PM

0

Set the control BackColor to Color.Transparent.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"João Santa Barbara" <joaosb@i24portugal.com> wrote in message
news:%23bG9$Gp4EHA.1300@TK2MSFTNGP14.phx.gbl...
> Hi all
> i'm doing a form that i paint on the event onpaint.
> And i want to make all controls in that form to become transparent in the
> way i can see the form background is it possible how ??
>
> thks
> JSB
>
> PS: any sample !!!
>
>


ae

12/20/2004 5:05:00 PM

0

How is BackColor programmed in code? I tried
Button1.BackColor = "Transparent";

I'm only getting errors.

"Bob Powell [MVP]" wrote:

> Set the control BackColor to Color.Transparent.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "João Santa Barbara" <joaosb@i24portugal.com> wrote in message
> news:%23bG9$Gp4EHA.1300@TK2MSFTNGP14.phx.gbl...
> > Hi all
> > i'm doing a form that i paint on the event onpaint.
> > And i want to make all controls in that form to become transparent in the
> > way i can see the form background is it possible how ??
> >
> > thks
> > JSB
> >
> > PS: any sample !!!
> >
> >
>
>
>

End Liberalism

12/21/2004 2:50:00 PM

0


Button1.BackColor = Color.Transparent;

just as Bob stated



"ae" <ae@discussions.microsoft.com> wrote in message
news:89A080C0-CFF8-4270-B26C-B5D3B56955A1@microsoft.com...
> How is BackColor programmed in code? I tried
> Button1.BackColor = "Transparent";
>
> I'm only getting errors.
>
> "Bob Powell [MVP]" wrote:
>
> > Set the control BackColor to Color.Transparent.
> >
> > --
> > Bob Powell [MVP]
> > Visual C#, System.Drawing
> >
> > Find great Windows Forms articles in Windows Forms Tips and Tricks
> > http://www.bobpowell.net/tips...
> >
> > Answer those GDI+ questions with the GDI+ FAQ
> > http://www.bobpowell.net/f...
> >
> > All new articles provide code in C# and VB.NET.
> > Subscribe to the RSS feeds provided and never miss a new article.
> >
> >
> >
> >
> >
> > "João Santa Barbara" <joaosb@i24portugal.com> wrote in message
> > news:%23bG9$Gp4EHA.1300@TK2MSFTNGP14.phx.gbl...
> > > Hi all
> > > i'm doing a form that i paint on the event onpaint.
> > > And i want to make all controls in that form to become transparent in
the
> > > way i can see the form background is it possible how ??
> > >
> > > thks
> > > JSB
> > >
> > > PS: any sample !!!
> > >
> > >
> >
> >
> >


WhiskyRomeo

1/2/2005 10:49:00 PM

0

This doesn't make a control transparent with respect to other controls.

For example, doing this for a label laid over a picture box with an image in
it does not make the label transparent. The background is still there.

Why is something some simple, so hard?

wr



"Bob Powell [MVP]" wrote:

> Set the control BackColor to Color.Transparent.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "João Santa Barbara" <joaosb@i24portugal.com> wrote in message
> news:%23bG9$Gp4EHA.1300@TK2MSFTNGP14.phx.gbl...
> > Hi all
> > i'm doing a form that i paint on the event onpaint.
> > And i want to make all controls in that form to become transparent in the
> > way i can see the form background is it possible how ??
> >
> > thks
> > JSB
> >
> > PS: any sample !!!
> >
> >
>
>
>

Adam Edell via DotNetMonster.com

1/6/2005 4:44:00 AM

0

I'm new, too but just had a similar experience. It's not the color of the label that is the problem. It is the color of the control beneath. I did not find a way to give satisfactory results. This isn't what you asked, but it may do what you need.

Place your image in the picture box, then:

// add this code
Graphics g = this.CreateGraphics();
g.DrawString("My Label Text",new Font("Arial",8),Brushes.Black,100,100);
g.Dispose();
// end of added code

//100,100 is the location

--
Message posted via http://www.dotnetm...