vb编程在picturebox画圆

我要画那种弹性的图形,鼠标拖动时形状会变的圆PrivateSubPicture1_MouseDown(ButtonAsInteger,ShiftAsInteger,XAs... 我要画那种弹性的图形,鼠标拖动时形状会变的圆
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
formerX = X
formerY = Y
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)'鼠标移动
If Button = 1 Then
Picture1.Cls
For i = 1 To drawcount
With drawone(i)
rl = Sqr(((.x1 - .x2) ^ 2 + (.y1 - .y2) ^ 2))
Picture1.Circle (.x1, .y1), rl, .dcolor
End with
rl = Sqr((formerX - X) ^ 2 + (formerY - Y) ^ 2)
Picture1.Circle (formerX, formerY), rl
End if
End Sub

Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)'释放鼠标后

rl = Sqr((formerX - X) ^ 2 + (formerY - Y) ^ 2)
Picture1.Circle (formerX, formerY), rl
drawcount = drawcount + 1

If drawcount > 0 Then '动态数组存储图形信息
ReDim Preserve drawone(1 To drawcount)
With drawone(drawcount)
.x1 = formerX
.y1 = formerY
.x2 = X
.y2 = Y
.drawtype = drawt
.dcolor = Picture1.ForeColor
End With
End If

这个程序画出来的圆在中心水平线上半径是鼠标拖出来的半径,但在鼠标和中心在竖直线上的时候偏移量很大,怎么解决?
第二位画出来的鼠标位置确实是确定了半径,但是只能画圆弧吗?
展开
 我来答
luyifang2009
2009-06-27
知道答主
回答量:22
采纳率:0%
帮助的人:16.3万
展开全部
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then x1 = x: y1 = y
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
Picture1.AutoRedraw = False
Picture1.Refresh
Picture1.PSet (x1, y1)
Picture1.Circle (x1, y1), Sqr((x - x1) ^ 2 + (y - y1) ^ 2)
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
Picture1.AutoRedraw = True
Picture1.Circle (x1, y1), Sqr((x - x1) ^ 2 + (y - y1) ^ 2), End If
End Sub
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
home20010252
2009-06-23 · TA获得超过3319个赞
知道大有可为答主
回答量:1147
采纳率:0%
帮助的人:1184万
展开全部
是不是圆心偏左?

还是没看懂你的问题在哪儿,呵呵
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式