ayesha ahmad

ayesha ahmad

  • NA
  • 6
  • 8.1k

Fill a Rectangle in Windows Application C#

Jul 24 2013 2:42 AM
hi,

I have made a rectangle on my windows form using Rectangle Class.
Problem is that its width is 200 and height is 100.
I only want to fill the 4th part of rectangle means 50px out of total width 200px with brown colour.


System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(Color.Brown);
Rectangle rec = new Rectangle(0, 0, 200, 100);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.FillRectangle(myBrush, rec);


Any help will be highly appericated


Thanks


Answers (6)