T
Tony Johansson
Hi!
Below I have two event handlers.
I just wonder is it just a matter of tast which one to use.
I mean if perhaps one is better then the other.
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = CreateGraphics();
Pen pen = new Pen(Color.Maroon, 0);
Brush b = new LinearGradientBrush(new Point(1, 1),
new Point(100, 100),
Color.White,
Color.Red);
Point[] points = new Point[]
{new Point(10,10),
new Point(10,100),
new Point(50,65),
new Point(100,100),
new Point(85,40)};
g.DrawPolygon(pen, points);
g.FillPolygon(b, points);
g.DrawPolygon(pen, points);
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pen = new Pen(Color.Maroon, 0);
Brush b = new LinearGradientBrush(new Point(1, 1),
new Point(100, 100),
Color.White,
Color.Red);
Point[] points = new Point[]
{new Point(10,10),
new Point(10,100),
new Point(50,65),
new Point(100,100),
new Point(85,40)};
g.DrawPolygon(pen, points);
g.FillPolygon(b, points);
g.DrawPolygon(pen, points);
}
//Tony
Below I have two event handlers.
I just wonder is it just a matter of tast which one to use.
I mean if perhaps one is better then the other.
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = CreateGraphics();
Pen pen = new Pen(Color.Maroon, 0);
Brush b = new LinearGradientBrush(new Point(1, 1),
new Point(100, 100),
Color.White,
Color.Red);
Point[] points = new Point[]
{new Point(10,10),
new Point(10,100),
new Point(50,65),
new Point(100,100),
new Point(85,40)};
g.DrawPolygon(pen, points);
g.FillPolygon(b, points);
g.DrawPolygon(pen, points);
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pen = new Pen(Color.Maroon, 0);
Brush b = new LinearGradientBrush(new Point(1, 1),
new Point(100, 100),
Color.White,
Color.Red);
Point[] points = new Point[]
{new Point(10,10),
new Point(10,100),
new Point(50,65),
new Point(100,100),
new Point(85,40)};
g.DrawPolygon(pen, points);
g.FillPolygon(b, points);
g.DrawPolygon(pen, points);
}
//Tony