source: Include/Classes/System/Drawing/SizeF.ab@ 105

Last change on this file since 105 was 104, checked in by イグトランス (egtra), 18 years ago

Boolean対応ほか微修正

File size: 1.9 KB
Line 
1' Classes/System/Drawing/SizeF.ab
2
3#ifndef __SYSTEM_DRAWING_SIZEF_AB__
4#define __SYSTEM_DRAWING_SIZEF_AB__
5
6#include <Classes/System/Drawing/Size.ab>
7#include <Classes/System/Drawing/PointF.ab>
8
9Class SizeF
10Public
11 Sub SizeF()
12 width = 0
13 height = 0
14 End Sub
15
16 Sub SizeF(initWidth As Single, initHeight As Single)
17 width = initWidth
18 height = initHeight
19 End Sub
20
21 Sub SizeF(ByRef sz As SizeF)
22 width = sz.width
23 height = sz.height
24 End Sub
25
26 Function Width() As Single
27 Return width
28 End Function
29
30 Sub Width(w As Single)
31 width = w
32 End Sub
33
34 Function Height() As Single
35 Return height
36 End Function
37
38 Sub Height(h As Single)
39 height = h
40 End Sub
41
42 Function Operator + (sz As SizeF) As SizeF
43 Dim ret As SizeF(width + sz.width, height + sz.height)
44 Return ret
45 End Function
46
47 Function Operator - (sz As SizeF) As SizeF
48 Dim ret As SizeF(width - sz.width, height - sz.height)
49 Return ret
50 End Function
51
52 Function Operator == (sz As SizeF) As Boolean
53 Return Equals(sz)
54 End Function
55
56 Function Operator <> (sz As SizeF) As Boolean
57 Return Not Equals(sz)
58 End Function
59
60 Sub Operator = (ByRef sz As SizeF)
61 width = sz.width
62 height = sz.height
63 End Sub
64
65 Function Equals(sz As SizeF) As Boolean
66 If width = sz.width And height = sz.height Then
67 Equals = _System_TRUE
68 Else
69 Equals = _System_FALSE
70 End If
71 End Function
72
73 Function IsEmpty() As Boolean
74 If width = 0 And height = 0 Then
75 Empty = _System_TRUE
76 Else
77 Empty = _System_FALSE
78 End If
79 End Function
80
81 Function Add(sz As Size) As Size
82 Return This + sz
83 End Function
84
85 Function Subtract(sz As SizeF) As SizeF
86 Return This - sz
87 End Function
88
89 Function ToSize() As Size
90 Return Size.Round(This)
91 End Function
92
93 Function ToPointF() As PointF
94 Dim pt As PointF(width, height)
95 Return pt
96 End Function
97Private
98 width As Single
99 height As Single
100End Class
101
102#endif '__SYSTEM_DRAWING_SIZEF_AB__
Note: See TracBrowser for help on using the repository browser.