dotnet / dotnet/dotnet-api-docs
Clarify purpose of PaintEventArgs.ClipRectangle
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### 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
Contributor guide
Assessment
This issue has not been assessed yet.