dotnet-api-docs icon indicating copy to clipboard operation
dotnet-api-docs copied to clipboard

Clarify purpose of PaintEventArgs.ClipRectangle

Open Cygon opened this issue 1 year ago • 0 comments

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.

  1. Is PaintEventArgs.ClipRectangle always the entire client area of the control (= the area to which all drawing will be clipped, thus the name)?

  2. Is PaintEventArgs.ClipRectangle just an arbitrary rectangle that might or might not cover the whole control (= "dirty rectangles" method, hinting to OnPaint() 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

Cygon avatar Aug 18 '24 09:08 Cygon