-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfrmDebug.frm
157 lines (137 loc) · 4.02 KB
/
frmDebug.frm
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
VERSION 5.00
Begin VB.Form frmDebug
BorderStyle = 5 'Sizable ToolWindow
Caption = "Winunciator Debug"
ClientHeight = 2925
ClientLeft = 1380
ClientTop = 3675
ClientWidth = 6585
ClipControls = 0 'False
ControlBox = 0 'False
Icon = "frmDebug.frx":0000
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2925
ScaleWidth = 6585
ShowInTaskbar = 0 'False
Begin VB.CommandButton Command1
Caption = "CLEAR LOG"
Height = 315
Left = 30
TabIndex = 1
ToolTipText = "Clear Debug Log"
Top = 2610
Width = 6555
End
Begin VB.TextBox log1
Height = 2595
Left = 0
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 0
TabStop = 0 'False
Top = 0
Width = 6555
End
End
Attribute VB_Name = "frmDebug"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'resizer stuff
Private Type ControlPositionType
Left As Single
Top As Single
Width As Single
Height As Single
FontSize As Single
End Type
Private m_ControlPositions() As ControlPositionType
Private m_FormWid As Single
Private m_FormHgt As Single
Private Sub Command1_Click()
log1.Text = ""
logit ("Cleared Log.")
End Sub
Private Sub Form_Load()
SaveSizes
End Sub
''
'' Below here be the resizer codes
''
' Save the form's and controls' dimensions.
Private Sub SaveSizes()
Dim i As Integer
Dim ctl As Control
' Save the controls' positions and sizes.
ReDim m_ControlPositions(1 To Controls.Count)
i = 1
For Each ctl In Controls
With m_ControlPositions(i)
If TypeOf ctl Is Line Then
.Left = ctl.x1
.Top = ctl.y1
.Width = ctl.x2 - ctl.x1
.Height = ctl.y2 - ctl.y1
ElseIf TypeOf ctl Is Winsock Then
ElseIf TypeOf ctl Is Menu Then
Else
.Left = ctl.Left
.Top = ctl.Top
.Width = ctl.Width
.Height = ctl.Height
On Error Resume Next
.FontSize = ctl.Font.Size
On Error GoTo 0
End If
End With
i = i + 1
Next ctl
' Save the form's size.
m_FormWid = ScaleWidth
m_FormHgt = ScaleHeight
End Sub
' Arrange the controls for the new size.
Private Sub ResizeControls()
Dim i As Integer
Dim ctl As Control
Dim x_scale As Single
Dim y_scale As Single
' Don't bother if we are minimized.
If WindowState = vbMinimized Then Exit Sub
' Get the form's current scale factors.
x_scale = ScaleWidth / m_FormWid
y_scale = ScaleHeight / m_FormHgt
' Position the controls.
i = 1
For Each ctl In Controls
With m_ControlPositions(i)
If TypeOf ctl Is Line Then
ctl.x1 = x_scale * .Left
ctl.y1 = y_scale * .Top
ctl.x2 = ctl.x1 + x_scale * .Width
ctl.y2 = ctl.y1 + y_scale * .Height
ElseIf TypeOf ctl Is Winsock Then
ElseIf TypeOf ctl Is Menu Then
Else
ctl.Left = x_scale * .Left
ctl.Top = y_scale * .Top
ctl.Width = x_scale * .Width
If Not (TypeOf ctl Is ComboBox) Then
' Cannot change height of ComboBoxes.
ctl.Height = y_scale * .Height
End If
On Error Resume Next
ctl.Font.Size = y_scale * .FontSize
On Error GoTo 0
End If
End With
i = i + 1
Next ctl
End Sub
Private Sub Form_Resize()
ResizeControls
End Sub