2 qq 24142447 qq_24142447 于 2015.06.23 22:49 提问

v画圆问题 本人新手遇到这个问题找不到原因希望大神帮助

Dim x0 As Single, y0 As Single, x1 As Single, y1 As Single
Dim drawflag As Boolean, start As Boolean
Dim m As Integer
Dim shape As Integer

Private Sub btnLine_Click()
shape = 1
End Sub
Private Sub btnRadiu_Click()
shape = 2
End Sub
Private Sub btnSquare_Click()
shape = 3
End Sub
Private Sub btnStart_Click()
Picture1.BackColor = RGB(255, 255, 255)
btnStart.Enabled = False
btnStop.Enabled = True
drawflag = True
shape = 1
End Sub
Private Sub btnStop_Click()
btnStart.Enabled = True
btnStop.Enabled = False
drawflag = False
End Sub
Private Sub btnDelete_Click()
Picture1.Cls
End Sub
Private Sub btnColor_Click()
CommonDialog1.ShowColor
Picture1.ForeColor = CommonDialog1.Color
End Sub
Private Sub btnStyle_Click()
Dim a As Integer
a = Val(InputBox("请输入画笔宽度", "提示", m))
If a = 0 Then
a = m
End If
Picture1.DrawWidth = a
m = Picture1.DrawWidth
End Sub
Private Sub btnExit_Click()
End
End Sub
Private Sub myPaint_Load()
Me.Scale (-5, 5)-(5, -5)
Picture1.ForeColor = vbBlack
Picture1.DrawWidth = 1
m = 1
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 And drawflag = True Then
x0 = X
y0 = Y
start = True
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 And drawflag = True And start = True Then
Select Case shape
Case 1
x1 = X
y1 = Y
Picture1.Line (x0, y0)-(x1, y1)
x0 = x1
y0 = y1
Case 2
x1 = X
y1 = Y
Case 3
x1 = X
y1 = Y
End Select
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case shape
Case 1
x1 = X
y1 = Y
Picture1.Line (x0, y0)-(x1, y1)
x0 = x1
y0 = y1
start = False
Case 2
r = Sqr((x1 - x0) ^ 2 + (y1 - y0) ^ 2)
Picture1.Circle (x0, y0), r
Case 3
Picture1.Line (x0, y0)-(x1, y1), , B
End Select
End Sub

我遇到的问题是 画圆的时候只能显示一半 或者太大 大过控件大小不现实图片说明
急需解决 马上就要交作业了 qq 834789560

1个回答

devmiao
devmiao   Ds   Rxr 2015.06.23 23:11

把窗口做大一些,或者将圆心的位置,x y减少一点。

Csdn user default icon
上传中...
上传图片
插入图片