Drawing Rectangle on Window

Abhisek
Posted by Abhisek under C# category on | Views : 1638
Insert the following code in the forms constructor.

Public Form1()
{
InitializeComponent();
Graphics g = CreateGraphics();
Show();
Pen bluePen= new Pen(Color.Blue,3);//define pen
g.DrawRectangle(bluePen,0,0,50,50);//draw rectangle
}

Comments or Responses

Login to post response