-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormUtils.vb
More file actions
70 lines (70 loc) · 2.4 KB
/
FormUtils.vb
File metadata and controls
70 lines (70 loc) · 2.4 KB
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
Module FormUtils
Public Level As Short = 2
Public screenw, screenh As Integer
Public SpeedScale As Short
Public SizeScale As Double = 0.15
ReadOnly FontSizeScale As Double = 0.4
Public Sub FormReSize(ByRef form)
Dim width, height As Integer
If screenh > screenw Then
width = Int(SizeScale * screenw)
Else
width = Int(SizeScale * screenh)
End If
height = width - 10
form.Size = New Size(width, height)
form.MaximumSize = form.Size
form.MinimumSize = form.Size
form.Label1.Size = form.ClientSize
form.Label1.Location = New Point(0, 0)
form.Label1.Font = New Font("Arial", Int(FontSizeScale * width))
End Sub
Public Sub FormMove(ByRef form)
If Enemy.theWorld Then
Exit Sub
End If
Randomize()
form.SetDesktopLocation(
form.Location.X + form.x_sign * SpeedScale,
form.Location.Y + form.y_sign * SpeedScale
)
If form.Location.X + form.Size.Width > screenw And form.x_sign = 1 Then
form.x_sign = -1
End If
If form.Location.Y + form.Size.Height > screenh And form.y_sign = 1 Then
form.y_sign = -1
End If
If form.Location.Y < 0 And form.y_sign = -1 Then
form.y_sign = 1
End If
If form.Location.X < 0 And form.x_sign = -1 Then
form.x_sign = 1
End If
End Sub
Public Sub MsgBoxAttack()
MsgBox("Message Box攻擊!!", 16, "攻擊")
End Sub
Public Sub SuperMsgBoxAttack()
For i = 1 To 3
MsgBox("超Message Box攻擊!!", 48 + 256, "攻擊")
Next
End Sub
Public Sub HellMsgBoxAttack()
For i = 1 To 5
MsgBox("不可能的任務之Message Box攻擊!!", 48 + 256, "攻擊")
Next
End Sub
Public Sub InputBoxAttack()
InputBox("Input Box攻擊!!", "攻擊", XPos:=Int(Rnd() * screenw) - 100, YPos:=Int(Rnd() * screenh))
End Sub
Public Sub SuperInputBoxAttack()
For i = 1 To 2
InputBox("強Input Box攻擊!!", "攻擊", XPos:=Int(Rnd() * screenw) - 100, YPos:=Int(Rnd() * screenh))
Next
End Sub
Public Sub HellInputBoxAttack()
For i = 1 To 3
InputBox("超Input Box攻擊!!", "攻擊", XPos:=Int(Rnd() * screenw) - 100, YPos:=Int(Rnd() * screenh))
Next
End Sub
End Module