怎么用vb做一个画板?

 我来答
dispose
2008-04-11 · TA获得超过642个赞
知道小有建树答主
回答量:458
采纳率:0%
帮助的人:495万
展开全部
我以前做过,原创的。要的话留个邮箱,我发你。以下是代码:
Dim t As Byte, s As Byte, c As Byte

Private Sub Command1_Click()
t = 1
If Form1.ForeColor = Form1.BackColor Then ForeColor = QBColor(c)
If Form1.DrawWidth = 12 Then Form1.DrawWidth = s
End Sub

Private Sub Command2_Click()
Form1.DrawWidth = 12
t = 2
End Sub

Private Sub Command3_Click()
Cls
Form1.ForeColor = vbBlack
Form1.DrawWidth = 1
t = 1
End Sub

Private Sub Form_Load()
Dim i%
For i = 0 To 15
Picture1(i).BackColor = QBColor(i)
Next i
Form1.ForeColor = vbBlack
t = 1
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
CurrentX = X: CurrentY = Y
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = 1 And t = 1 Then Line -(X, Y)
If Button = 1 And t = 2 Then Form1.ForeColor = Form1.BackColor: Form1.MousePointer = 4: Line -(X, Y)
End Sub

Private Sub Picture1_Click(Index As Integer)
Form1.ForeColor = Picture1(Index).BackColor
c = Index
End Sub

Private Sub Picture2_Click()
Form1.DrawWidth = 1: s = 1
End Sub

Private Sub Picture3_Click()
Form1.DrawWidth = 2: s = 2
End Sub

Private Sub Picture4_Click()
Form1.DrawWidth = 4: s = 4
End Sub

Private Sub Picture5_Click()
Form1.DrawWidth = 8: s = 8
End Sub
AiPPT
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图... 点击进入详情页
本回答由AiPPT提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式