Problem painting WinForm with Linear Gradient background

  • Thread starter Thread starter David Clegg
  • Start date Start date
D

David Clegg

I'm trying to create a form with a Linear Gradient background. Thats
easy enough, but any Labels I have on the form do not have their
background painted correctly. Even though I have Label.BackColor set to
Color.Transparent, it is using the original BackColor of the Form. Here
is my code, which is called in the Paint event for the Form ...

private void LoginForm_Paint(object sender,
System.Windows.Forms.PaintEventArgs e) {

LinearGradientBrush brush = new LinearGradientBrush(
e.ClipRectangle, Color.Black, Color.Blue,
LinearGradientMode.Vertical);
e.Graphics.FillRectangle(brush, this.ClientRectangle);
}

Am I going to have to override the Paint event for the Label components
as well and manually output the text?

--
Cheers,
David Clegg
dclegg_at_ebetonline_dot_com

"I know I'm not usually a praying man, but if you're up there, please
Superman, help me!" - Homer Simpson
 
Back
Top