Goto the Properties of the Form, then click on the Events Button (Lightening Bolt). Find "Paint" then double click next to it, to automatically create the required code for you.
To draw other objects, have a look in the Graphics class.
G.DrawEllipse(
new Pen(Color.Pink), new Rectangle(200, 50, 25, 25));
drawing something to the form---
enzamatic
private void Form1_Paint(object sender, PaintEventArgs e).....
but how do i get to this , this is in the toolbox or i have just to write every time this syntax
and how do i draw a cercle
fermion
Depending on why you want to draw on the form, you can chose which suits your needs.
Options A: Use the forms Paint event, to draw the graphics everytime the form is painted...
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics G = e.Graphics;
G.DrawLine(new Pen(Color.Black), new Point(25, 25), new Point(125, 25));
G.Dispose();
}
Options B: Use the forms CreateGraphics method, which will draw on the form, but not persist once its repainted...
private void DrawOnForm()
{
Graphics G = this.CreateGraphics();
G.DrawRectangle(new Pen(Color.Blue), new Rectangle(50, 50, 100, 100));
G.Dispose();
}
Phillip Georgieff
To draw other objects, have a look in the Graphics class.
G.DrawEllipse(
new Pen(Color.Pink), new Rectangle(200, 50, 25, 25));