1 | 'Classes/System/Drawing/Drawing2D/HatchBrush.ab
|
---|
2 |
|
---|
3 | #require <Classes/System/Drawing/Brush.ab>
|
---|
4 | #require <Classes/System/Drawing/Color.ab>
|
---|
5 | #require <gdiplusflat.ab>
|
---|
6 |
|
---|
7 | Namespace System
|
---|
8 | Namespace Drawing
|
---|
9 | Namespace Drawing2D
|
---|
10 |
|
---|
11 | Enum HatchStyle
|
---|
12 | Horizontal ' 0
|
---|
13 | Vertical ' 1
|
---|
14 | ForwardDiagonal ' 2
|
---|
15 | BackwardDiagonal ' 3
|
---|
16 | Cross ' 4
|
---|
17 | DiagonalCross ' 5
|
---|
18 | Percent05 ' 6
|
---|
19 | Percent10 ' 7
|
---|
20 | Percent20 ' 8
|
---|
21 | Percent25 ' 9
|
---|
22 | Percent30 ' 10
|
---|
23 | Percent40 ' 11
|
---|
24 | Percent50 ' 12
|
---|
25 | Percent60 ' 13
|
---|
26 | Percent70 ' 14
|
---|
27 | Percent75 ' 15
|
---|
28 | Percent80 ' 16
|
---|
29 | Percent90 ' 17
|
---|
30 | LightDownwardDiagonal ' 18
|
---|
31 | LightUpwardDiagonal ' 19
|
---|
32 | DarkDownwardDiagonal ' 20
|
---|
33 | DarkUpwardDiagonal ' 21
|
---|
34 | WideDownwardDiagonal ' 22
|
---|
35 | WideUpwardDiagonal ' 23
|
---|
36 | LightVertical ' 24
|
---|
37 | LightHorizontal ' 25
|
---|
38 | NarrowVertical ' 26
|
---|
39 | NarrowHorizontal ' 27
|
---|
40 | DarkVertical ' 28
|
---|
41 | DarkHorizontal ' 29
|
---|
42 | DashedDownwardDiagonal ' 30
|
---|
43 | DashedUpwardDiagonal ' 31
|
---|
44 | DashedHorizontal ' 32
|
---|
45 | DashedVertical ' 33
|
---|
46 | SmallConfetti ' 34
|
---|
47 | LargeConfetti ' 35
|
---|
48 | ZigZag ' 36
|
---|
49 | Wave ' 37
|
---|
50 | DiagonalBrick ' 38
|
---|
51 | HorizontalBrick ' 39
|
---|
52 | Weave ' 40
|
---|
53 | Plaid ' 41
|
---|
54 | Divot ' 42
|
---|
55 | DottedGrid ' 43
|
---|
56 | DottedDiamond ' 44
|
---|
57 | Shingle ' 45
|
---|
58 | Trellis ' 46
|
---|
59 | Sphere ' 47
|
---|
60 | SmallGrid ' 48
|
---|
61 | SmallCheckerBoard ' 49
|
---|
62 | LargeCheckerBoard ' 50
|
---|
63 | OutlinedDiamond ' 51
|
---|
64 | SolidDiamond ' 52
|
---|
65 |
|
---|
66 | LargeGrid = 4 'Cross
|
---|
67 |
|
---|
68 | HatchStyleMin = 0 'Horizontal
|
---|
69 | HatchStyleMax = 52 'SolidDiamond
|
---|
70 | End Enum
|
---|
71 |
|
---|
72 | Class HatchBrush
|
---|
73 | Inherits Brush
|
---|
74 | Public
|
---|
75 | Sub HatchBrush(hatchStyle As HatchStyle, foreColor As /*Const*/ Color, backColor /*= New Color*/ As /*Const*/ Color)
|
---|
76 | Dim brush = 0 As *GpHatch
|
---|
77 | lastResult = GdiPlus.DllExports.GdipCreateHatchBrush(hatchStyle, foreColor.Value, backColor.Value, brush)
|
---|
78 | SetNativeBrush(brush)
|
---|
79 | End Sub
|
---|
80 |
|
---|
81 | Sub HatchBrush(hatchStyle As HatchStyle, foreColor As /*Const*/ Color)
|
---|
82 | Dim brush = 0 As *GpHatch
|
---|
83 | lastResult = GdiPlus.DllExports.GdipCreateHatchBrush(hatchStyle, foreColor.Value, backColor.Value, brush)
|
---|
84 | SetNativeBrush(brush)
|
---|
85 | End Sub
|
---|
86 |
|
---|
87 | Const Function GetHatchStyle() As HatchStyle
|
---|
88 | SetStatus(GdiPlus.DllExports.GdipGetHatchStyle(nativeBrush As *GpHatch, GetHatchStyle))
|
---|
89 | End Function
|
---|
90 |
|
---|
91 | Const Function GetForegroundColor() As Color
|
---|
92 | Dim argb As ARGB
|
---|
93 | GetForegroundColor = SetStatus(GdiPlus.DllExports.GdipGetHatchForegroundColor(nativeBrush As *GpHatch, argb))
|
---|
94 | Return New Color(argb)
|
---|
95 | End Function
|
---|
96 |
|
---|
97 | Const Function GetBackgroundColor() As Color
|
---|
98 | Dim argb As ARGB
|
---|
99 | GetBackgroundColor = SetStatus(GdiPlus.DllExports.GdipGetHatchBackgroundColor(nativeBrush As *GpHatch, argb))
|
---|
100 | Return New Color(argb)
|
---|
101 | End Function
|
---|
102 |
|
---|
103 | 'Protected
|
---|
104 | Sub HatchBrush()
|
---|
105 | End Sub
|
---|
106 | End Class
|
---|
107 |
|
---|
108 | End Namespace 'Drawing2D
|
---|
109 | End Namespace 'Drawing
|
---|
110 | End Namespace 'System
|
---|