source: branch/egtra-stream-without-en_dec/Classes/System/Drawing/PointF.ab@ 673

Last change on this file since 673 was 473, checked in by イグトランス (egtra), 17 years ago

実験として書いていたControlクラスを追加(せめてコミット前に既存のContorolに混ぜようとしたがコンパイルできなかった)。
ほかForms, Drawing及びGDI+の修正。

File size: 2.4 KB
Line 
1' Classes/System/Drawing/PointF.ab
2
3Namespace System
4Namespace Drawing
5
6Class PointF
7Public
8 Sub PointF()
9 x = 0
10 y = 0
11 End Sub
12
13 Sub PointF(initX As Single, initY As Single)
14 x = initX
15 y = initY
16 End Sub
17
18 Sub PointF(pt As PointF)
19 x = pt.x
20 y = pt.y
21 End Sub
22
23 Sub PointF(sz As SizeF)
24 x = sz.Width
25 y = sz.Height
26 End Sub
27
28 Function X() As Single
29 X = x
30 End Function
31
32 Sub X(newX As Single)
33 x = newX
34 End Sub
35
36 Function Y() As Single
37 Y = y
38 End Function
39
40 Sub Y(newY As Single)
41 y = newY
42 End Sub
43
44 Function IsEmpty() As Boolean
45 Return x = 0 And y = 0
46 End Function
47
48 Function Operator + (pt As PointF) As PointF
49 Return Add(This, pt)
50 End Function
51
52 Function Operator + (sz As Size) As PointF
53 Return Add(This, sz)
54 End Function
55
56 Function Operator + (sz As SizeF) As PointF
57 Return Add(This, sz)
58 End Function
59
60 Function Operator - (pt As PointF) As PointF
61 Return Substract(This, pt)
62 End Function
63
64 Function Operator - (sz As Size) As PointF
65 Return Substract(This, sz)
66 End Function
67
68 Function Operator - (sz As SizeF) As PointF
69 Return Substract(This, sz)
70 End Function
71
72 Function Operator == (sz As PointF) As Boolean
73 Return Equals(sz)
74 End Function
75
76 Function Operator <> (sz As PointF) As Boolean
77 Return Not Equals(sz)
78 End Function
79
80 Static Function Add(pt1 As PointF, pt2 As PointF) As PointF
81 Return New PointF(pt1.x + pt2.x, pt1.y + pt2.y)
82 End Function
83
84 Static Function Add(pt As PointF, sz As Size) As PointF
85 Return New PointF(pt.x + sz.Width, pt.y + sz.Height)
86 End Function
87
88 Static Function Add(pt As PointF, sz As SizeF) As PointF
89 Return New PointF(pt.x + sz.Width, pt.y + sz.Height)
90 End Function
91
92 Static Function Substract(pt1 As PointF, pt2 As PointF) As PointF
93 Return New PointF(pt1.x - pt2.x, pt1.y - pt2.y)
94 End Function
95
96 Static Function Substract(pt As PointF, sz As Size) As PointF
97 Return New PointF(pt.x - sz.Width, pt.y - sz.Height)
98 End Function
99
100 Static Function Substract(pt As PointF, sz As SizeF) As PointF
101 Return New PointF(pt.x - sz.Width, pt.y - sz.Height)
102 End Function
103
104 Function Equals(pt As PointF) As Boolean
105 Return x = pt.x And y = pt.y
106 End Function
107
108 Override Function GetHashCode() As Long
109 Return (GetDWord(VarPtr(x)) Xor _System_BSwap(GetDWord(VarPtr(x)))) As Long
110 End Function
111
112Private
113 x As Single
114 y As Single
115End Class
116
117End Namespace
118End Namespace
Note: See TracBrowser for help on using the repository browser.