-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.vb
110 lines (86 loc) · 2.43 KB
/
Point.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Imports System.Runtime.Serialization
'Wrapper Klasse für Point
<DataContractAttribute ( Namespace := "" ) > _
Public Class Point
Implements Positionable
Public mover As InteractiveLocation
Public Event PosChanged(sender As Point)
Public Sub New(il As InteractiveLocation)
mover = il
mover.AddClient(Me)
End Sub
Public Sub New()
Me.New(New InteractiveLocation())
End Sub
#Region "Wrapper Methods"
'<DataMemberattribute (Name := "punkt" ) > _
Public pt As Drawing.Point 'it's a structure!
Public Sub New(x As Integer, y As Integer)
Me.New() 'creats new Interactive Location
pt.X = x
pt.Y = y
mover.Pos = pt
End Sub
Public Sub New(x As Integer, y As Integer, il As InteractiveLocation)
Me.New(il)
pt.X = x
pt.Y = y
mover.Pos = pt
End Sub
Public Sub New(point As Drawing.Point)
Me.New(point.X, point.Y)
End Sub
Public Sub New(point As Drawing.Point, il As InteractiveLocation)
Me.New(point.X, point.Y, il)
End Sub
<DataMemberattribute> _
Public Property X As Integer
Get
Return pt.X
End Get
Set(value As Integer)
pt.X = value
End Set
End Property
<DataMemberattribute> _
Public Property Y As Integer
Get
Return pt.Y
End Get
Set(value As Integer)
pt.Y = value
End Set
End Property
Public Shared ReadOnly Property Empty As Point
Get
Return New Point(0, 0)
End Get
End Property
'Public Shared Operator +(ByVal Value As Point, ByVal Add As Point) As Drawing.Point
' Return Value.pt + Add.pt
' End Operator
'Public Shared Operator -(ByVal Value As Point, ByVal Add As Point) As Drawing.Point
' Return Value.pt - Add.pt
' End Operator
'Public Shared Operator -(ByVal Value As Point, ByVal Add As Drawing.Point) As Drawing.Point
' Return Value.pt - Add
' End Operator
'Public Shared Operator -(ByVal Value As Drawing.Point, ByVal Add As Point) As Drawing.Point
' Return Value - Add.pt
' End Operator
#End Region '"Wrapper Methods"
#Region "Positionable Implementaion"
Event detatch (client As Positionable ) Implements Positionable.detatch
Public Property Offset As New Drawing.Point Implements Positionable.Offset
Public Property Pos As Drawing.Point Implements Positionable.Pos
Get
Return Me.pt
End Get
Set(value As Drawing.Point)
pt = value
RaiseEvent PosChanged(Me)
'mover.Pos = pt
End Set
End Property
#End Region '#Region "Positionable Implementaion"
End Class