private void UserControl1_Paint(object sender, PaintEventArgs e) { Rectangle BaseRectangle = new Rectangle(0, 0, this.Width - 1, this.Height - 1); Brush Gradient_Brush = new LinearGradientBrush(BaseRectangle, Color.Navy, Color.LightSlateGray, LinearGradientMode.Vertical); e.Graphics.FillRectangle(Gradient_Brush, BaseRectangle); }I want to change it to this, but I don't know the syntax to raise the Paint event.
private LinearGradientMode _GradientMode = LinearGradientMode.Vertical; public LinearGradientMode GradientMode { get { return _GradientMode; } set { _GradientMode = value; // Raise the event here } } private Color _ColorStart = Color.White; public Color ColorStart { get { return _ColorStart; } set { _ColorStart = value; // Raise the event here } } private Color _ColorEnd = Color.White; public Color ColorEnd { get { return _ColorEnd; } set { _ColorEnd = value; // Raise the event here } } private void UserControl1_Paint(object sender, PaintEventArgs e) { Rectangle BaseRectangle = new Rectangle(0, 0, this.Width - 1, this.Height - 1); Brush Gradient_Brush = new LinearGradientBrush(BaseRectangle, _ColorStart, _ColorEnd, _GradientMode); e.Graphics.FillRectangle(Gradient_Brush, BaseRectangle); }