M
Michael
Hello, I am trying to follow a graphics tutorial which gives the
following code
private void DrawShapesForm_Paint(object sender, PaintEventArgs e)
{
// references to object we will use
Graphics graphicsObject = e.Graphics;
// ellipse rectangle and gradient brush
Rectangle drawArea1 = new Rectangle(5, 35, 30, 100);
LinearGradientBrush linearBrush =
new LinearGradientBrush(drawArea1, Color.Blue,
Color.Yellow, LinearGradientMode.ForwardDiagonal);
// draw ellipse filled with a blue-yellow gradient
graphicsObject.FillEllipse(linearBrush, 5, 30, 65, 100);
}
//---------------------------------------
Now on a form I have placed a single command button and want the
above to execute when I click it. In the (Paint) events tab of the button I
have
enabled DrawShapesForm_Paint.
So far nothing is happening when I click the button. Am using VS2008.
What am I doing wrong, or perhaps failing to do?
TIA Mick
following code
private void DrawShapesForm_Paint(object sender, PaintEventArgs e)
{
// references to object we will use
Graphics graphicsObject = e.Graphics;
// ellipse rectangle and gradient brush
Rectangle drawArea1 = new Rectangle(5, 35, 30, 100);
LinearGradientBrush linearBrush =
new LinearGradientBrush(drawArea1, Color.Blue,
Color.Yellow, LinearGradientMode.ForwardDiagonal);
// draw ellipse filled with a blue-yellow gradient
graphicsObject.FillEllipse(linearBrush, 5, 30, 65, 100);
}
//---------------------------------------
Now on a form I have placed a single command button and want the
above to execute when I click it. In the (Paint) events tab of the button I
have
enabled DrawShapesForm_Paint.
So far nothing is happening when I click the button. Am using VS2008.
What am I doing wrong, or perhaps failing to do?
TIA Mick