vb鼠标涂鸦板的制作
生活随笔
收集整理的這篇文章主要介紹了
vb鼠标涂鸦板的制作
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
實驗要求
效果
清除畫布的代碼(本實驗沒添加這個功能,留著備用)
代碼
Dim x1 As Integer Dim x2 As Integer Dim y1 As Integer Dim y2 As Integer Dim flag As BooleanPrivate Sub Command1_Click()On Error Resume NextCommonDialog1.CancelError = TrueCommonDialog1.DialogTitle = "顏色"CommonDialog1.ShowColorIf Err <> 32755 ThenPicture1.ForeColor = CommonDialog1.ColorEnd If End SubPrivate Sub Form_Load()Picture1.Scale (0, 0)-(400, 400)flag = False End SubPrivate Sub Option1_Click()Picture1.DrawWidth = 1 End SubPrivate Sub Option2_Click()Picture1.DrawWidth = 2 End SubPrivate Sub Option3_Click()Picture1.DrawWidth = 3 End SubPrivate Sub Option4_Click()Picture1.DrawWidth = 50 End SubPrivate Sub Picture1_MouseDown(button As Integer, shift As Integer, x As Single, y As Single)flag = Truex1 = xy1 = yPicture1.Line (x1, y1)-(x1 + 1, y1 + 1) End SubPrivate Sub Picture1_MouseMove(button As Integer, shift As Integer, x As Single, y As Single)If flag = False ThenExit SubEnd IfIf flag = True Thenx2 = xy2 = yPicture1.Line (x1, y1)-(x2, y2)x1 = x2y1 = y2End IfEnd Sub Private Sub Picture1_MouseUp(button As Integer, shift As Integer, x As Single, y As Single)flag = False End Sub總結
以上是生活随笔為你收集整理的vb鼠标涂鸦板的制作的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【教程】如何给Eclipse中添加库(j
- 下一篇: vb 五位抽奖程序