Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Raise Paint Event
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
How To Raise Paint Event
Miscellaneous
Thread ID:
01393497
Message ID:
01393497
Views:
85
I have this code in a Panel control:
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);
}
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform