C# 调用GDI函数 CreatePen 和CreateSolidBrush函数时 颜色的问题

C# 中导入gdi函数

[DllImport("gdi32.dll")]
public static extern IntPtr CreateSolidBrush(int crColor);
[DllImport("gdi32.dll")]
public static extern IntPtr CreatePen(int nPenStyle, int nWidth, int crColor);

使用时发现,要想将颜色设置为白色,需要如下操作

hPen = CreatePen(PS_SOLID, 1, 0);//创建白色画刷
hBrush = CreateSolidBrush(0);//创建白色画刷

原文地址:https://www.cnblogs.com/merlinzjl/p/13435384.html