I need to create a Graphics element on a rectangle (Rectangle). But I do not understand how to do it. Example:

Rectangle r = new Rectangle(); r.Location = new Point(x,y); Graphics g = r.CreateGraphics(); 

But this does not work, because for the rectangle there is no CreateGraphics () method.

  • DrawRectangle - Alexander Petrov
  • Thank you, figured out. - Lenator pm

1 answer 1

You can draw directly in a rectangle.

 g.DrawImage(image, r);