Clarify purpose of PaintEventArgs.ClipRectangle
Type of issue
Missing information
Description
For as long as I've been using WinForms, I've always been a little unsure about what the PaintEventArgs.ClipRectangle property is actually communicating to my Control.OnPaint() method.
-
Is
PaintEventArgs.ClipRectanglealways the entire client area of the control (= the area to which all drawing will be clipped, thus the name)? -
Is
PaintEventArgs.ClipRectanglejust an arbitrary rectangle that might or might not cover the whole control (= "dirty rectangles" method, hinting toOnPaint()to skip drawing content if it's outside the rectangle)?
It would be really useful if the page could state whether it's one or the other.
If option 1) applies, perhaps also state whether it is appropriate to paint the entire PaintEventArgs.ClipRectangle (i.e. is it the client area or is it the entire control's area and Control.ClientRectangle should be used to calculates image size and such.
Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.painteventargs.cliprectangle?view=windowsdesktop-8.0
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Windows.Forms/PaintEventArgs.xml
Document Version Independent Id
dc1fb090-9738-8bce-a376-618ae522dc19
Article author
@dotnet-bot