Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Raise Paint Event
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
How To Raise Paint Event
Divers
Thread ID:
01393497
Message ID:
01393497
Vues:
86
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform