What problem does it solve?
WinForms developers need consistent rules for using GDI+ efficiently (caching pens and brushes, managing graphics state, disposing resources) and a strict pattern for adding new drawing APIs to System.Drawing without breaking versioning or documentation conventions.
Core Features & Use Cases
- Performance-oriented drawing rules: Use cached pen/brush scopes, SystemPens/SystemBrushes, and GraphicsInternal to reduce allocation overhead in control painting.
- State and resource management: Save and restore graphics state (SmoothingMode, clip, transform) and correctly dispose non-cacheable GDI+ objects like GraphicsPath.
- New API authoring pattern: Add Draw/Fill primitives and GraphicsPath methods with .NET version guards, integer/float overload pairs, and proper XML documentation.
- Use Case: When adding a DrawRoundedRectangle API to System.Drawing, follow the checklist to guard it with #if NET11_0_OR_GREATER, provide both Rectangle and RectangleF overloads, and place it adjacent to DrawRectangle.
Quick Start
Ask the AI to review or write WinForms painting code that uses cached pens and brushes and properly restores graphics state.