Create a rectangle at run time on C # .NET GUI form

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();
}


Next Recommended Reading How to create 7 segment by graphic?