New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move DrawEdge to Interop User32 #2835
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2835 +/- ##
===================================================
+ Coverage 59.52976% 59.54232% +0.01255%
===================================================
Files 1237 1237
Lines 429911 429911
Branches 38783 38783
===================================================
+ Hits 255925 255979 +54
+ Misses 168606 168552 -54
Partials 5380 5380
|
internal static partial class User32 | ||
{ | ||
[DllImport(Libraries.User32, ExactSpelling = true)] | ||
private static extern BOOL DrawEdge(IntPtr hDC, ref RECT rect, uint edge, uint flags); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to import the enums as well: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawedge
We already have EDGE
and BDR
enums:
winforms/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.EDGE.cs
Lines 11 to 22 in 5d7ad6e
[Flags] | |
public enum EDGE : uint | |
{ | |
RAISEDOUTER = BDR.RAISEDOUTER, | |
SUNKENOUTER = BDR.SUNKENOUTER, | |
RAISEDINNER = BDR.RAISEDINNER, | |
SUNKENINNER = BDR.SUNKENINNER, | |
RAISED = RAISEDOUTER | RAISEDINNER, | |
SUNKEN = SUNKENOUTER | SUNKENINNER, | |
ETCHED = SUNKENOUTER | RAISEDINNER, | |
BUMP = RAISEDOUTER | SUNKENINNER, | |
} |
winforms/src/System.Windows.Forms.Primitives/src/Interop/User32/Interop.BDR.cs
Lines 11 to 22 in 5d7ad6e
[Flags] | |
public enum BDR : uint | |
{ | |
RAISEDOUTER = 0x0001, | |
SUNKENOUTER = 0x0002, | |
RAISEDINNER = 0x0004, | |
SUNKENINNER = 0x0008, | |
OUTER = RAISEDOUTER | SUNKENOUTER, | |
INNER = RAISEDINNER | SUNKENINNER, | |
RAISED = RAISEDOUTER | RAISEDINNER, | |
SUNKEN = SUNKENOUTER | SUNKENINNER, | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking further about it, we probably should have 2 different definitions, e.g.:
[DllImport(Libraries.User32, ExactSpelling = true)]
private static extern BOOL DrawEdge(IntPtr hDC, ref RECT rect, BDR edge, BF flags);
[DllImport(Libraries.User32, ExactSpelling = true)]
private static extern BOOL DrawEdge(IntPtr hDC, ref RECT rect, EDGE edge, BF flags);
But in #2033 we have extended the EDGE
enum beyond the Win32 definition (@hughbe any recollection as to why it was done?).
So I think the interop should look like:
[DllImport(Libraries.User32, ExactSpelling = true)]
private static extern BOOL DrawEdge(IntPtr hDC, ref RECT rect, EDGE edge, BF flags);
As well as Border3DStyle
needs to be fixed, see #2033 (comment)
Thank you |
Proposed changes
Microsoft Reviewers: Open in CodeFlow