How to clear the graphics (rectangle shape) in the image window

I created a custom rectangle control, and I use this custom control in my application. In my application, I process the image for various operations, such as reading a barcode from images, etc. If I have two options for image processing, it processes the entire image, and the other processes the selected part of the image, I select the specific part of the image using the shape of a rectangle (this is user control). So I gave two options in my GUI for this purpose - this is the whole image and the other is Rectangle.if I used the rectangle for the first time for selection, and the next time I selected the whole image, then the previously selected rectangle shape was not removed from image windows.So how can I remove this rectangle shape from my PictureBox? The figure below shows the shape of the rectangle in the image window. enter image description here

+3
source share
1 answer

Try Graphics.clear();orthis.Invalidate();

+3
source

All Articles