3个回答
展开全部
创建一个工程,界面上放一个PictureBox控件,控件名字叫Picture1,然后把下面的代码复制到工程中,运行查看效果。
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private DrawEllipse As Boolean
Private dwPoint(1) As POINTAPI
Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = True
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DrawEllipse = True
dwPoint(0).x = CLng(x)
dwPoint(0).y = CLng(y)
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If DrawEllipse = True Then
dwPoint(1).x = CLng(x)
dwPoint(1).y = CLng(y)
Picture1.Cls
Ellipse Picture1.hdc, dwPoint(0).x, dwPoint(0).y, dwPoint(1).x, dwPoint(1).y
Picture1.Refresh
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DrawEllipse = False
End If
End Sub
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function Ellipse Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private DrawEllipse As Boolean
Private dwPoint(1) As POINTAPI
Private Sub Form_Load()
Picture1.ScaleMode = vbPixels
Picture1.AutoRedraw = True
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DrawEllipse = True
dwPoint(0).x = CLng(x)
dwPoint(0).y = CLng(y)
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If DrawEllipse = True Then
dwPoint(1).x = CLng(x)
dwPoint(1).y = CLng(y)
Picture1.Cls
Ellipse Picture1.hdc, dwPoint(0).x, dwPoint(0).y, dwPoint(1).x, dwPoint(1).y
Picture1.Refresh
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DrawEllipse = False
End If
End Sub
东莞大凡
2024-08-07 广告
2024-08-07 广告
棋盘格标定板是机器视觉与摄影测量中常用的校准工具,用于精确校准相机镜头或传感器的内外参数。您可以通过搜索“高清棋盘格标定板图片”在专业图像库或开源平台找到适合您需求的资源。下载后,选择高分辨率版本,使用高质量打印机及适合您应用需求的纸张材质...
点击进入详情页
本回答由东莞大凡提供
展开全部
如果用代码``可以这样画``Private Sub Form_Click()
Dim CX, CY, Radius, Limit ' Declare variable.
ScaleMode = 7 ' 以厘米为单位。
CX = ScaleWidth / 2 ' X 位置。
CY = ScaleHeight / 2 ' Y 位置。
Circle (CX, CY), 1, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
End Sub
如果手画可以~~
单击工具箱里的Shape按钮``画个长方体
单击长方体改它属性里的shape属性改成2-oval
Dim CX, CY, Radius, Limit ' Declare variable.
ScaleMode = 7 ' 以厘米为单位。
CX = ScaleWidth / 2 ' X 位置。
CY = ScaleHeight / 2 ' Y 位置。
Circle (CX, CY), 1, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
End Sub
如果手画可以~~
单击工具箱里的Shape按钮``画个长方体
单击长方体改它属性里的shape属性改成2-oval
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
高手
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询