M
Mark Roebke
Hello, I think I have a pretty simple problem, but have
spent a lot of time researching, only to find no 'real'
solution.
I have a Panel control that I'm filling with a gradient
using a LinearGradientBrush in the Paint event of the
Panel:
Control control = (Control)sender;
Graphics g = control.CreateGraphics();
g.Clear(Color.White);
Color startColor = Color.FromArgb(106, 127, 156);
Color endColor = Color.FromArgb(177, 197, 218);
LinearGradientBrush darkBrush = new LinearGradientBrush
(control.ClientRectangle, startColor, endColor,
LinearGradientMode.Vertical);
g.FillRectangle(darkBrush, control.ClientRectangle);
g.Dispose();
I have a Label control (on the Panel) that I want to
display transparent and thus show the Panel's gradient. I
have tried all the suggestions made in other posts
including:
Setting the BackColor of the Label to Transparent
Setting the Visible property of the Label to False and
then to True in code following the Paint event
Set the Label's Parent to the Panel in code
It doesn't seem to pick up what is drawn in the Paint
event, instead relying on the BackColor of the Panel set
at design time.
Any ideas?
Thanks,
Mark Roebke
RTP
spent a lot of time researching, only to find no 'real'
solution.
I have a Panel control that I'm filling with a gradient
using a LinearGradientBrush in the Paint event of the
Panel:
Control control = (Control)sender;
Graphics g = control.CreateGraphics();
g.Clear(Color.White);
Color startColor = Color.FromArgb(106, 127, 156);
Color endColor = Color.FromArgb(177, 197, 218);
LinearGradientBrush darkBrush = new LinearGradientBrush
(control.ClientRectangle, startColor, endColor,
LinearGradientMode.Vertical);
g.FillRectangle(darkBrush, control.ClientRectangle);
g.Dispose();
I have a Label control (on the Panel) that I want to
display transparent and thus show the Panel's gradient. I
have tried all the suggestions made in other posts
including:
Setting the BackColor of the Label to Transparent
Setting the Visible property of the Label to False and
then to True in code following the Paint event
Set the Label's Parent to the Panel in code
It doesn't seem to pick up what is drawn in the Paint
event, instead relying on the BackColor of the Panel set
at design time.
Any ideas?
Thanks,
Mark Roebke
RTP