📄 form1.frm
字号:
TabIndex = 32
Top = 3480
Width = 90
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "4"
Height = 180
Index = 3
Left = 600
TabIndex = 31
Top = 3240
Width = 90
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "3"
Height = 180
Index = 2
Left = 600
TabIndex = 30
Top = 3000
Width = 90
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "2"
Height = 180
Index = 1
Left = 600
TabIndex = 29
Top = 2760
Width = 90
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "1"
Height = 180
Index = 0
Left = 600
TabIndex = 28
Top = 2520
Width = 90
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "10"
Height = 300
Index = 9
Left = 5280
TabIndex = 27
Top = 2160
Width = 300
End
Begin VB.Label Label5
Caption = "9"
Height = 255
Index = 8
Left = 4800
TabIndex = 26
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "8"
Height = 255
Index = 7
Left = 4320
TabIndex = 25
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "7"
Height = 255
Index = 6
Left = 3840
TabIndex = 24
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "6"
Height = 255
Index = 5
Left = 3360
TabIndex = 23
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "5"
Height = 255
Index = 4
Left = 2880
TabIndex = 22
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "4"
Height = 255
Index = 3
Left = 2400
TabIndex = 21
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "3"
Height = 255
Index = 2
Left = 1920
TabIndex = 20
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "2"
Height = 255
Index = 1
Left = 1440
TabIndex = 19
Top = 2160
Width = 375
End
Begin VB.Label Label5
Caption = "1"
Height = 255
Index = 0
Left = 960
TabIndex = 18
Top = 2160
Width = 375
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "0"
Height = 180
Left = 600
TabIndex = 17
Top = 2280
Width = 90
End
Begin VB.Label Label3
Caption = "圆心 (x , y) 半径 R"
Height = 375
Left = 4200
TabIndex = 16
Top = 960
Width = 3975
End
Begin VB.Label Label2
Caption = "线条宽度"
Height = 255
Left = 8160
TabIndex = 7
Top = 120
Width = 855
End
Begin VB.Label Label1
Caption = "起点 (x , y) 终点 (x , y)"
Height = 255
Left = 4200
TabIndex = 5
Top = 120
Width = 3855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Picture1.DrawWidth = Val(Text5.Text)
dx = Val(Text3.Text) * 567 - Val(Text1.Text) * 567 'dx=xe-xs;
dy = Val(Text4.Text) * 567 - Val(Text2.Text) * 567 'dy=ye-ys;
x = 0
y = 0
d = 2 * x * dy - 2 * y * dx + 2 * dy - dx
For i = 0 To dx - 1
Picture1.PSet (x + Val(Text1.Text) * 567, y + Val(Text2.Text) * 567), CommonDialog1.Color
If d >= 0 Then
y = y + 1
x = x + 1
d = d + 2 * dy - 2 * dx
Else
x = x + 1
d = d + 2 * dy
End If
Next
End Sub
Private Sub Command2_Click()
CommonDialog1.ShowColor
End Sub
Private Sub Command3_Click()
Unload Form1
Form1.Show
End Sub
Private Sub Command4_Click()
Picture1.DrawWidth = Val(Text9.Text)
x = 0
y = Val(Text8.Text) * 567
p = 1 - y
'Picture1.PSet (Val(Text6.Text) * 567, Val(Text7.Text) * 567), CommonDialog1.Color
While x < y
x = x + 1
If p < 0 Then
p = p + 2 * x + 1
Else
y = y - 1
p = p + 2 * (x - y) + 1
End If
Picture1.PSet (Val(Text6.Text) * 567 + x, Val(Text7.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - x, Val(Text7.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - x, Val(Text7.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 + x, Val(Text7.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 + y, Val(Text7.Text) * 567 + x), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 + y, Val(Text7.Text) * 567 - x), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - y, Val(Text7.Text) * 567 + x), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - y, Val(Text7.Text) * 567 - x), CommonDialog1.Color
Wend
End Sub
Private Sub Command5_Click()
Picture1.DrawWidth = Val(Text12.Text)
a = Val(Text10.Text) * 567
b = Val(Text11.Text) * 567
x = 0
y = b
d1 = b * b + a * a * (-b + 0.25)
While (b * b * (x + 1) < a * a * (y - 0.5))
If (d1 < 0) Then
d1 = d1 + b * b * (2 * x + 3)
x = x + 1
Else
d1 = d1 + (b * b * (2 * x + 3) + a * a * (-2 * y + 2))
x = x + 1
y = y - 1
End If
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Wend
d2 = Sqr(b * (x + 0.5)) + Sqr(a * (y - 1)) - Sqr(a * b)
While y > 0
If (d2 < 0) Then
d2 = d2 + b * b * (2 * x + 2) + a * a * (-2 * y + 3)
x = x + 1
y = y - 1
Else
d2 = d2 + a * a * (-2 * y + 3)
y = y - 1
End If
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Wend
End Sub
Private Sub Command6_Click()
Command6.Enabled = False
Picture1.DrawWidth = Val(Text9.Text)
a = Val(Text8.Text) * 567
For i = 1 To a
y = i
x = 0
p = 1 - y
'Picture1.PSet (Val(Text6.Text) * 567, Val(Text7.Text) * 567), CommonDialog1.Color
While x < y
x = x + 1
If p < 0 Then
p = p + 2 * x + 1
Else
y = y - 1
p = p + 2 * (x - y) + 1
End If
Picture1.PSet (Val(Text6.Text) * 567 + x, Val(Text7.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - x, Val(Text7.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - x, Val(Text7.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 + x, Val(Text7.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 + y, Val(Text7.Text) * 567 + x), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 + y, Val(Text7.Text) * 567 - x), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - y, Val(Text7.Text) * 567 + x), CommonDialog1.Color
Picture1.PSet (Val(Text6.Text) * 567 - y, Val(Text7.Text) * 567 - x), CommonDialog1.Color
Wend
Next
Command6.Enabled = True
End Sub
Private Sub Command7_Click()
Command7.Enabled = False
On Error GoTo lp
Picture1.DrawWidth = Val(Text12.Text)
a = Int(Val(Text10.Text) * 567)
b = Int(Val(Text11.Text) * 567)
For g = b To 0 Step -1
a = a - 1
b = b - 1
x = 0
y = b
d1 = b * b + a * a * (-b + 0.25)
While (b * b * (x + 1) < a * a * (y - 0.5))
If (d1 < 0) Then
d1 = d1 + b * b * (2 * x + 3)
x = x + 1
Else
d1 = d1 + (b * b * (2 * x + 3) + a * a * (-2 * y + 2))
x = x + 1
y = y - 1
End If
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Wend
d2 = Sqr(b * (x + 0.5)) + Sqr(a * (y - 1)) - Sqr(a * b)
While y > 0
If (d2 < 0) Then
d2 = d2 + b * b * (2 * x + 2) + a * a * (-2 * y + 3)
x = x + 1
y = y - 1
Else
d2 = d2 + a * a * (-2 * y + 3)
y = y - 1
End If
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 + x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 + y), CommonDialog1.Color
Picture1.PSet (Val(Text13.Text) * 567 - x, Val(Text14.Text) * 567 - y), CommonDialog1.Color
Wend
Next
lp: Command7.Enabled = True
End Sub
Private Sub Form_Paint()
For i = 0 To 17
Label5(i).Left = Picture1.Left + (i + 1) * 567
Next
For i = 0 To 11
Label6(i).Top = Picture1.Top + (i + 1) * 567
Next
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -