在VB中picture框中用鼠标绘的图如何输出?

来源:百度知道 编辑:UC知道 时间:2024/05/16 09:47:37
如题,设计了一个程序,在picture框中导入的图可以作为图片导出,但用鼠标在上面绘制图却输不出,如何实现鼠标绘的图也可以以图片格式输出?
picture框就是picturebox工具.

Private Sub Form_Click()
' 声明变量。
Dim CX, CY, Limit, Radius As Integer, Msg As String
ScaleMode = vbPixels ' 设置比例模型为像素。
AutoRedraw = True ' 打开 AutoRedraw。
Width = Height ' 改变宽度以便和高度匹配。
CX = ScaleWidth / 2 ' 设置 X 位置。
CY = ScaleHeight / 2 ' 设置 Y 位置。
Limit = CX ' 圆的尺寸限制。
For Radius = 0 To Limit ' 设置半径。
Circle (CX, CY), Radius, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
DoEvents ' 转移到其它操作。
Next Radius
Msg = "Choose OK to save the graphics from this form "
Msg = Msg & "to a bitmap file."
MsgBox Msg
SavePicture Image, "TEST.BMP" ' 将图片保存到文件。
End Sub