-
Notifications
You must be signed in to change notification settings - Fork 32
/
AlignerControls.bas
248 lines (207 loc) · 7.08 KB
/
AlignerControls.bas
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
Attribute VB_Name = "Aligner_Module"
' #VBIDEUtils#************************************************************
' * Programmer Name : removed
' * Web Site : http://www.ppreview.net
' * E-Mail : removed
' * Date : 03/25/2001
' * Time : 13:25
' * Module Name : Aligner_Module
' * Module Filename : AlignerControls.bas
' **********************************************************************
' * Comments :
' *
' *
' **********************************************************************
Option Explicit
Public Sub AlignControlsLeft()
' #VBIDEUtils#************************************************************
' * Programmer Name : removed
' * Web Site : http://www.ppreview.net
' * E-Mail : removed
' * Date : 03/25/2001
' * Time : 13:24
' * Module Name : Aligner_Module
' * Module Filename : AlignerControls.bas
' * Procedure Name : AlignControlsLeft
' * Parameters :
' **********************************************************************
' * Comments :
' *
' *
' **********************************************************************
' #VBIDEUtilsERROR#
On Error GoTo ERROR_AlignControlsLeft
Dim AllControls
Dim Control As Object
Dim nControlLeft As Long
nControlLeft = 0
' *** Get collection containing all selected controls on form
Set AllControls = VBInstance.SelectedVBComponent.Designer.SelectedVBControls
' *** For each control on the active form...
For Each Control In AllControls
' *** Find the farthest left
With Control.Properties
If nControlLeft = 0 Then
nControlLeft = .Item("Left")
Else
If .Item("left") < nControlLeft Then nControlLeft = .Item("Left")
End If
End With
Next Control
' *** For each control on the active form...
For Each Control In AllControls
' *** ...align control
With Control.Properties
.Item("left") = nControlLeft
End With
Next Control
EXIT_AlignControlsLeft:
Exit Sub
' #VBIDEUtilsERROR#
ERROR_AlignControlsLeft:
Resume EXIT_AlignControlsLeft
End Sub
Public Sub AlignControlsRight()
' #VBIDEUtils#************************************************************
' * Programmer Name : removed
' * Web Site : http://www.ppreview.net
' * E-Mail : removed
' * Date : 03/25/2001
' * Time : 13:24
' * Module Name : Aligner_Module
' * Module Filename : AlignerControls.bas
' * Procedure Name : AlignControlsRight
' * Parameters :
' **********************************************************************
' * Comments :
' *
' *
' **********************************************************************
' #VBIDEUtilsERROR#
On Error GoTo ERROR_AlignControlsRight
Dim AllControls
Dim Control As Object
Dim nControlRight As Long
nControlRight = 0
' *** Get collection containing all selected controls on form
Set AllControls = VBInstance.SelectedVBComponent.Designer.SelectedVBControls
' *** For each control on the active form...
For Each Control In AllControls
' *** Find the farthest Right
With Control.Properties
If nControlRight = 0 Then
nControlRight = .Item("Left")
Else
If .Item("Left") > nControlRight Then nControlRight = .Item("Left")
End If
End With
Next Control
' *** For each control on the active form...
For Each Control In AllControls
' *** ...align control
With Control.Properties
.Item("Left") = nControlRight
End With
Next Control
EXIT_AlignControlsRight:
Exit Sub
' #VBIDEUtilsERROR#
ERROR_AlignControlsRight:
Resume EXIT_AlignControlsRight
End Sub
Public Sub AlignControlsTop()
' #VBIDEUtils#************************************************************
' * Programmer Name : removed
' * Web Site : http://www.ppreview.net
' * E-Mail : removed
' * Date : 03/25/2001
' * Time : 13:24
' * Module Name : Aligner_Module
' * Module Filename : AlignerControls.bas
' * Procedure Name : AlignControlsTop
' * Parameters :
' **********************************************************************
' * Comments :
' *
' *
' **********************************************************************
' #VBIDEUtilsERROR#
On Error GoTo ERROR_AlignControlsTop
Dim AllControls
Dim Control As Object
Dim nControlTop As Long
nControlTop = 0
' *** Get collection containing all selected controls on form
Set AllControls = VBInstance.SelectedVBComponent.Designer.SelectedVBControls
' *** For each control on the active form...
For Each Control In AllControls
' *** Find the farthest Top
With Control.Properties
If nControlTop = 0 Then
nControlTop = .Item("Top")
Else
If .Item("Top") < nControlTop Then nControlTop = .Item("Top")
End If
End With
Next Control
' *** For each control on the active form...
For Each Control In AllControls
' *** ...align control
With Control.Properties
.Item("Top") = nControlTop
End With
Next Control
EXIT_AlignControlsTop:
Exit Sub
' #VBIDEUtilsERROR#
ERROR_AlignControlsTop:
Resume EXIT_AlignControlsTop
End Sub
Public Sub AlignControlsBottom()
' #VBIDEUtils#************************************************************
' * Programmer Name : removed
' * Web Site : http://www.ppreview.net
' * E-Mail : removed
' * Date : 03/25/2001
' * Time : 13:24
' * Module Name : Aligner_Module
' * Module Filename : AlignerControls.bas
' * Procedure Name : AlignControlsBottom
' * Parameters :
' **********************************************************************
' * Comments :
' *
' *
' **********************************************************************
' #VBIDEUtilsERROR#
On Error GoTo ERROR_AlignControlsBottom
Dim AllControls
Dim Control As Object
Dim nControlBottom As Long
nControlBottom = 0
' *** Get collection containing all selected controls on form
Set AllControls = VBInstance.SelectedVBComponent.Designer.SelectedVBControls
' *** For each control on the active form...
For Each Control In AllControls
' *** Find the farthest Bottom
With Control.Properties
If nControlBottom = 0 Then
nControlBottom = .Item("Top")
Else
If .Item("Top") > nControlBottom Then nControlBottom = .Item("Top")
End If
End With
Next Control
' *** For each control on the active form...
For Each Control In AllControls
' *** ...align control
With Control.Properties
.Item("Top") = nControlBottom
End With
Next Control
EXIT_AlignControlsBottom:
Exit Sub
' #VBIDEUtilsERROR#
ERROR_AlignControlsBottom:
Resume EXIT_AlignControlsBottom
End Sub