hello!
in vb6 you can simply drag and drop circle or the square,
in c#.net how can i do that?
thanks a bunch.
Printable View
hello!
in vb6 you can simply drag and drop circle or the square,
in c#.net how can i do that?
thanks a bunch.
You draw shapes in .NET using GDI+. You store the values that describe what you want to draw in control variables then you force the control on which you want to draw to repaint itself by calling its Refresh method or, preferably, its Invalidate and Update methods. This will raise the control's Paint event. You then read the values from the control variables in the control's Paint event handler and perform the appropriate drawing, e.g.Code:private Point centre;
private int radius;
private void DrawCircle(Point centre, int radius)
{
this.centre = centre;
this.radius = radius;
this.Refresh();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawEllipse(Pens.Black,
centre.X - radius,
centre.Y - radius,
2 * radius,
2 * radius);
}