說明:
CreateSolidBrush 函式可建立一支具有指定顏色的實心畫刷(Brush)
引用函式庫:
GDI32
適用系統:
Windows NT 3.1 或 Windows 95以上
函式原型:
Declare Function CreateSolidBrush Lib "gdi32" Alias "CreateSolidBrush" ( _ ByVal crColor As Long _ ) As Long
參數型態及說明:
crColor:Long 指定畫刷(Brush)的顏色
回傳值:
Long 呼叫成功的話,將會回傳畫刷(Brush)的代碼;若呼叫失敗的話,則回傳 0
.NET Framework API:
System.Drawing.SolidBrush
VB範例:
檢視原始碼 Visual Basic
1 2 3 4 5 6 7 8 9 | 'VB的宣告 Private Declare Function CreateSolidBrush Lib "gdi32" ( _ ByVal crColor As Long _ ) As Long Dim mBrush As Long '產生一支紅色的畫刷(Brush) mBrush = CreateSolidBrush(&HFF) |
RB範例:
檢視原始碼 REALBasic
1 2 3 4 5 6 7 8 9 | 'RB的宣告 Declare Function CreateSolidBrush Lib "gdi32" ( _ crColor As Integer _ ) As Integer Dim mBrush As Integer '產生一支紅色的畫刷(Brush) mBrush = CreateSolidBrush(&HFF) |
VB.NET範例:
檢視原始碼 VB.NET
1 2 3 4 5 6 7 8 9 10 11 | 'VB.NET的宣告 <DllImport("gdi32.dll")> _ Shared Function CreateSolidBrush( _ ByVal crColor As UInteger _ ) As IntPtr End Function Dim mBrush As IntPtr '產生一支紅色的畫刷(Brush) mBrush = CreateSolidBrush(&HFF) |
C#範例:
檢視原始碼 C#
1 2 3 4 5 6 7 8 9 10 | //C#的宣告 [DllImport("gdi32")] public static extern IntPtr CreateSolidBrush( uint crColor ); IntPtr mBrush; //產生一支紅色的畫刷(Brush) mBrush = CreateSolidBrush(0xFF); |