Search code examples
c#winformsdrawingdrawrectangle

Updating a rectangle list


Am drawing multiple rectangles in a windows form using graphics.DrawRectangle and is adding every rectangle to a rectangle list.later am editing the location a nd size of these rectangles.my doubt is whether i can edit the values of a rectangle in a rectangle list?


Solution

  • You can do this:

    Rectangle temp = RectList[0];
    temp.Width = 100;
    temp.Height = 100;
    temp.X = 0;
    temp.Y=0;
    RectList[0] = temp;