This will add a rectangle to the form at run time at the specify location which you give as numbers:-
private void button_Click(object sender, EventArgs e)
{
Rectangle myrect = new Rectangle(200, 300, 100, 100);
Graphics g = this.CreateGraphics();
g.DrawRectangle(SystemPens.ControlDark, myrect);
g.Dispose();
}


Mahesh ChandTOP 10Posted Apr 15, 2009, 12:50 PM EDT
You may want to format your code. See how I changed the code in your blog. One way to have colored code, copy your code from Visual Studio to a doc file and then copy it here in the editor. OR use the Border Dash option in this editor.
Nikhil KumarPosted Apr 15, 2009, 9:28 AM EDT
Try it