You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider Changing CombineRgn Return Type to Enum #1024
Is your feature request related to a problem? Please describe.
The current return type of CombineRgn is an int, which affects code readability since getting a 0 as a return may not immediately signify to the reader that there was an error, and no region was created. To work around this, users could create their own enum type, but even then they would still need to cast their enum type everywhere they want to check the return of CombineRgn.
Describe the solution you'd like
Have CombineRgn return an enum type for readability and cleanliness. Perhaps something like:
Your enum looks good. The 3 non-zero values are already defined as constants in the metadata and could be relocated to the enum. The value for ERROR should be defined natively in the enum rather than relocating it (if it's in the metadata) since it obviously isn't named specifically for the region APIs and probably is used elsewhere.
Activity
AArnott commentedon Aug 3, 2022
Your enum looks good. The 3 non-zero values are already defined as constants in the metadata and could be relocated to the enum. The value for
ERRORshould be defined natively in the enum rather than relocating it (if it's in the metadata) since it obviously isn't named specifically for the region APIs and probably is used elsewhere.mikebattista commentedon Aug 3, 2022
Windows.Win32.Graphics.Gdi.GDI_REGION_TYPE not found in 1st winmd
Windows.Win32.Graphics.Gdi.Apis.ERROR...System.UInt32 => System.Int32
Windows.Win32.Graphics.Gdi.Apis.NULLREGION not found in 2nd winmd
Windows.Win32.Graphics.Gdi.Apis.SIMPLEREGION not found in 2nd winmd
Windows.Win32.Graphics.Gdi.Apis.COMPLEXREGION not found in 2nd winmd
Windows.Win32.Graphics.Gdi.Apis.RGN_ERROR not found in 2nd winmd
Windows.Win32.Graphics.Gdi.Apis.CombineRgn : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.ExcludeClipRect : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.GetClipBox : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.GetRgnBox : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.IntersectClipRect : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.OffsetClipRgn : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.OffsetRgn : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.SelectClipRgn : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.ExtSelectClipRgn : return...Int32 => GDI_REGION_TYPE
Windows.Win32.Graphics.Gdi.Apis.SetMetaRgn : return...Int32 => GDI_REGION_TYPE
mikebattista commentedon Aug 3, 2022
I left ERROR separate for now and added RGN_ERROR to the enum which was an existing alias for ERROR.
mikebattista commentedon Aug 3, 2022
I'm planning to ship a metadata update later this week so if there are other issues affecting WinForms, let me know.
Fixed microsoft#1024.