C# Programming
06-26-2009, 08:20 PM
Im having problems with System.Drawing the code below only works when the user clicks the button but when set to the forms autostart option the line isn't drawn on the form . Ive tried thread.sleep but i get the same rusult the code is executed but nothing is drawb
private void Draw(object sender, EventArgs e)
{
System.Drawing.Graphics graphicsObj;
graphicsObj = this.CreateGraphics();
Pen myPen = new Pen(System.Drawing.Color.Red, 465);
graphicsObj.DrawLine(myPen, 120, 120, 1200, 1210);
}
private void button1_Click(object sender, EventArgs e)
{
System.Drawing.Graphics graphicsObj;
graphicsObj = this.CreateGraphics();
Pen myPen = new Pen(System.Drawing.Color.Red, 465);
graphicsObj.DrawLine(myPen, 120, 120, 1200, 1210);
}
hers my project
http://rapidshare.com/files/248914335/WindowsApplication1.zip
private void Draw(object sender, EventArgs e)
{
System.Drawing.Graphics graphicsObj;
graphicsObj = this.CreateGraphics();
Pen myPen = new Pen(System.Drawing.Color.Red, 465);
graphicsObj.DrawLine(myPen, 120, 120, 1200, 1210);
}
private void button1_Click(object sender, EventArgs e)
{
System.Drawing.Graphics graphicsObj;
graphicsObj = this.CreateGraphics();
Pen myPen = new Pen(System.Drawing.Color.Red, 465);
graphicsObj.DrawLine(myPen, 120, 120, 1200, 1210);
}
hers my project
http://rapidshare.com/files/248914335/WindowsApplication1.zip