Transparent Label on a Panel with Paint

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi,

I use paint event to draw gradient on a Panel.
But how to get the label to be transaparent on a gradient draw Panel?

Thank you.

Regards,
Daniel
 
Hi Daniel,

Set the label's BackGroundColor = Color.Transparent

If you use ClipRectangle for your gradient calculation the gradient for the label will be different than the background.
 
Hi Morten,

I've tried the transparent for backcolor, but it doesn't work.
The below is the coding to draw the gradient. Could that be other way of
writing?
System.Drawing.Drawing2D.LinearGradientBrush brush = new
System.Drawing.Drawing2D.LinearGradientBrush(new
System.Drawing.RectangleF(0,0, this.Width, this.Height), Color.Blue,
Color.SkyBlue, System.Drawing.Drawing2D.LinearGradientMode.Vertical);

graphics g = this.CreateGraphics();

g.FillRectangle(brush, new RectangleF(0,0,this.Width, this.Height));

g.Dispose();


Thank you.


Regards,
Daniel
BCE Software Sdn Bhd


Morten Wennevik said:
Hi Daniel,

Set the label's BackGroundColor = Color.Transparent

If you use ClipRectangle for your gradient calculation the gradient for
the label will be different than the background.
 
Back
Top