主题:有谁知道VB中用len方法画圆思路
我的代码如下:但是我很想用画直线的方法来画圆(不是指Circle方法)
Const a As Single = 1.2
Private Sub Form_Click()
Width = 8000
Height = 8000
Line (ScaleWidth / 3, ScaleWidth / 3)-(ScaleWidth * 2 / 3, ScaleWidth * 2 / 3), , B
DrawRect 1, ScaleWidth / 2 + ScaleWidth / 6 + ScaleWidth / 18 * a, ScaleWidth / 2, ScaleWidth / 9 * a
DrawRect 2, ScaleWidth / 2, ScaleWidth / 2 - ScaleWidth / 6 - ScaleWidth / 18 * a, ScaleWidth / 9 * a
DrawRect 3, ScaleWidth / 2 - ScaleWidth / 6 - ScaleWidth / 18 * a, ScaleWidth / 2, ScaleWidth / 9 * a
DrawRect 4, ScaleWidth / 2, ScaleWidth / 2 + ScaleWidth / 6 + ScaleWidth / 18 * a, ScaleWidth / 9 * a
End Sub
Private Sub DrawRect(Direct As Integer, x As Integer, Y As Integer, L As Integer)
If L < 100 Then
Line (x - L / 2, Y - L / 2)-(x + L / 2, Y + L / 2), , B
Else
Line (x - L / 2, Y - L / 2)-(x + L / 2, Y + L / 2), , B
Select Case Direct
Case 1
DrawRect 1, x + L / 2 + L / 6 * a, Y, L / 3 * a
DrawRect 2, x, Y - L / 2 - L / 6 * a, L / 3 * a
DrawRect 4, x, Y + L / 2 + L / 6 * a, L / 3 * a
Case 2
DrawRect 1, x + L / 2 + L / 6 * a, Y, L / 3 * a
DrawRect 2, x, Y - L / 2 - L / 6 * a, L / 3 * a
DrawRect 3, x - L / 2 - L / 6 * a, Y, L / 3 * a
Case 3
DrawRect 2, x, Y - L / 2 - L / 6 * a, L / 3 * a
DrawRect 3, x - L / 2 - L / 6 * a, Y, L / 3 * a
DrawRect 4, x, Y + L / 2 + L / 6 * a, L / 3 * a
Case 4
DrawRect 1, x + L / 2 + L / 6 * a, Y, L / 3 * a
DrawRect 3, x - L / 2 - L / 6 * a, Y, L / 3 * a
DrawRect 4, x, Y + L / 2 + L / 6 * a, L / 3 * a
End Select
End If
End Sub
Const a As Single = 1.2
Private Sub Form_Click()
Width = 8000
Height = 8000
Line (ScaleWidth / 3, ScaleWidth / 3)-(ScaleWidth * 2 / 3, ScaleWidth * 2 / 3), , B
DrawRect 1, ScaleWidth / 2 + ScaleWidth / 6 + ScaleWidth / 18 * a, ScaleWidth / 2, ScaleWidth / 9 * a
DrawRect 2, ScaleWidth / 2, ScaleWidth / 2 - ScaleWidth / 6 - ScaleWidth / 18 * a, ScaleWidth / 9 * a
DrawRect 3, ScaleWidth / 2 - ScaleWidth / 6 - ScaleWidth / 18 * a, ScaleWidth / 2, ScaleWidth / 9 * a
DrawRect 4, ScaleWidth / 2, ScaleWidth / 2 + ScaleWidth / 6 + ScaleWidth / 18 * a, ScaleWidth / 9 * a
End Sub
Private Sub DrawRect(Direct As Integer, x As Integer, Y As Integer, L As Integer)
If L < 100 Then
Line (x - L / 2, Y - L / 2)-(x + L / 2, Y + L / 2), , B
Else
Line (x - L / 2, Y - L / 2)-(x + L / 2, Y + L / 2), , B
Select Case Direct
Case 1
DrawRect 1, x + L / 2 + L / 6 * a, Y, L / 3 * a
DrawRect 2, x, Y - L / 2 - L / 6 * a, L / 3 * a
DrawRect 4, x, Y + L / 2 + L / 6 * a, L / 3 * a
Case 2
DrawRect 1, x + L / 2 + L / 6 * a, Y, L / 3 * a
DrawRect 2, x, Y - L / 2 - L / 6 * a, L / 3 * a
DrawRect 3, x - L / 2 - L / 6 * a, Y, L / 3 * a
Case 3
DrawRect 2, x, Y - L / 2 - L / 6 * a, L / 3 * a
DrawRect 3, x - L / 2 - L / 6 * a, Y, L / 3 * a
DrawRect 4, x, Y + L / 2 + L / 6 * a, L / 3 * a
Case 4
DrawRect 1, x + L / 2 + L / 6 * a, Y, L / 3 * a
DrawRect 3, x - L / 2 - L / 6 * a, Y, L / 3 * a
DrawRect 4, x, Y + L / 2 + L / 6 * a, L / 3 * a
End Select
End If
End Sub