⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 board.frm

📁 内似于WINDOWS的画比工具的VB程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
'hRgn = CreatePolygonRgn(XYPOINT(0), cn, 1)
cn = 0
Picture1.AutoRedraw = True
End If
'喷枪:timer停止
If Huabi = 12 Then
  Timer1.Enabled = False
End If
'画线:鼠标左键是前景颜色,鼠标右键是背景颜色
If Huabi = 2 And Button = 1 Then
Picture1.Line (x1, y1)-(x2, y2), Curcolor
Line1.Visible = False
End If
If Huabi = 2 And Button = 2 Then
Picture1.Line (x1, y1)-(x2, y2), Curbkcolor
Line1.Visible = False
End If

'画圆角矩形,鼠标左键是前景颜色,鼠标右键是背景颜色
If Huabi = 15 And Button = 1 And lindex.Caption = 0 Then
Picture1.ForeColor = Curcolor
RoundRect Picture1.hDC, x1, y1, x2, y2, 30, 30
Picture1.Refresh
Shape2.Visible = False
End If
If Huabi = 15 And Button = 1 And lindex.Caption = 1 Then
Picture1.FillColor = Curbkcolor
Picture1.ForeColor = Curcolor
RoundRect Picture1.hDC, x1, y1, x2, y2, 30, 30
Picture1.Refresh
Shape2.Visible = False
End If
If Huabi = 15 And Button = 1 And lindex.Caption = 2 Then
Picture1.FillColor = Curbkcolor
Picture1.ForeColor = Curbkcolor
RoundRect Picture1.hDC, x1, y1, x2, y2, 30, 30
Picture1.Refresh
Shape2.Visible = False
End If

If Huabi = 15 And Button = 2 And lindex.Caption = 0 Then
Picture1.ForeColor = Curbkcolor
RoundRect Picture1.hDC, x1, y1, x2, y2, 30, 30
Picture1.Refresh
Shape2.Visible = False
End If
If Huabi = 15 And Button = 2 And lindex.Caption = 1 Then
Picture1.FillColor = Curcolor
Picture1.ForeColor = Curbkcolor
RoundRect Picture1.hDC, x1, y1, x2, y2, 30, 30
Picture1.Refresh
Shape2.Visible = False
End If
If Huabi = 15 And Button = 2 And lindex.Caption = 2 Then
Picture1.FillColor = Curcolor
Picture1.ForeColor = Curcolor
RoundRect Picture1.hDC, x1, y1, x2, y2, 30, 30
Picture1.Refresh
Shape2.Visible = False
End If
'画圆:鼠标左键是前景颜色,鼠标右键是背景颜色
On Error GoTo a:
If Huabi = 3 And Button = 1 Then
Picture1.Circle ((x2 + x1) / 2, (y2 + y1) / 2), r / 2, Curcolor, , , (maxy - miny) / (maxx - minx)
Shape2.Visible = False
End If
If Huabi = 3 And Button = 2 Then
Picture1.Circle ((x2 + x1) / 2, (y2 + y1) / 2), r / 2, Curbkcolor, , , (maxy - miny) / (maxx - minx)
Shape2.Visible = False
End If
a:
'画矩形:鼠标左键是前景颜色,鼠标右键是背景颜色
'index=0 画空心形
'index=1 画实心形
'index=2 画无边实心形
If Huabi = 4 And Button = 1 And lindex.Caption = 0 Then
Picture1.Line (x1, y1)-(x2, y2), Curcolor, B
Shape2.Visible = False
End If
If Huabi = 4 And Button = 1 And lindex.Caption = 1 Then
Form1.Picture1.FillColor = Curbkcolor
Picture1.Line (x1, y1)-(x2, y2), Curcolor, B
Shape2.Visible = False
End If
If Huabi = 4 And Button = 1 And lindex.Caption = 2 Then
Form1.Picture1.FillColor = Curbkcolor
Picture1.Line (x1, y1)-(x2, y2), Curbkcolor, B
Shape2.Visible = False
End If

If Huabi = 4 And Button = 2 And lindex.Caption = 0 Then
Picture1.Line (x1, y1)-(x2, y2), Curbkcolor, B
Shape2.Visible = False
End If
If Huabi = 4 And Button = 2 And lindex.Caption = 1 Then
Form1.Picture1.FillColor = Curcolor
Picture1.Line (x1, y1)-(x2, y2), Curbkcolor, B
Shape2.Visible = False
End If
If Huabi = 4 And Button = 2 And lindex.Caption = 2 Then
Form1.Picture1.FillColor = Curcolor
Picture1.Line (x1, y1)-(x2, y2), Curcolor, B
Shape2.Visible = False
End If


'吸管的颜色选取,鼠标左键是前景颜色,鼠标右键是背景颜色
If Huabi = 8 And Button = 1 Then
Form2.Picture11.BackColor = Form2.Picture9.BackColor
End If
If Huabi = 8 And Button = 2 Then
Form2.Picture10.BackColor = Form2.Picture9.BackColor
End If
'选取区域的确定
If Huabi = 6 Then
Selectx2 = X
Selecty2 = Y
End If
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form2.Labelx.Caption = X
Form2.Labely.Caption = Y
'喷枪:在图形框上要画的点的坐标
If Huabi = 12 And Button = 1 Then
Timer1.Enabled = True
    nX = X
    nY = Y
 b = Button
End If
'填充颜色的移动
If Huabi = 5 And (Button = 1 Or Button = 2) Then
Select Case Button
Case 1
pic_paint Curcolor, X, Y
Case 2
pic_paint Curbkcolor, X, Y
End Select
End If
'橡皮的移动
If Huabi = 7 Then
Shape1.Top = Y
Shape1.Left = X
End If
'刷子的移动
If Huabi = 9 Then
Shape1.Top = Y
Shape1.Left = X
End If
'吸管的移动,动态取色
If Huabi = 8 Then
Form2.Picture9.BackColor = Form1.Picture1.Point(X, Y)
End If
'有颜色的操作:鼠标左键是前景颜色,鼠标右键是背景颜色
If Button = 1 Or Button = 2 Then
'画笔的轨迹
    If Huabi = 1 And Button = 1 Then
    Form1.Picture1.Line -(X, Y), Curcolor
    End If
    If Huabi = 1 And Button = 2 Then
    Picture1.Line -(X, Y), Curbkcolor
    End If
'任意选择
'If Huabi = 14 Then
'Form1.Picture1.Line -(X, Y), vbBlack
'Me.AutoRedraw = False
'End If
'橡皮的轨迹
    If Huabi = 7 And Button = 2 Then
    Picture1.Line (Shape1.Left, Shape1.Top)-(Shape1.Left + Shape1.Width, Shape1.Top + Shape1.Height), Curcolor, BF
    End If
    If Huabi = 7 And Button = 1 Then
    Picture1.Line (Shape1.Left, Shape1.Top)-(Shape1.Left + Shape1.Width, Shape1.Top + Shape1.Height), Curbkcolor, BF
    End If
'刷子的轨迹
    If Huabi = 9 Then
    If Form1.lindex.Caption <= 3 Then
    Line6.x1 = X
    Line6.y1 = Y
    Line6.x2 = X + (4 - Form1.lindex.Caption) * 3
    Line6.y2 = Y + (4 - Form1.lindex.Caption) * 3
    If Button = 1 Then
    Picture1.FillStyle = 0
    Picture1.FillColor = Curcolor
    Line6.Visible = True
    Picture1.Circle (X, Y), (4 - Form1.lindex.Caption) * 3 / 2, Curcolor
    End If
    If Button = 2 Then
    Picture1.FillStyle = 0
    Picture1.FillColor = Curbkcolor
    Line6.Visible = True
    Picture1.Circle (X, Y), (4 - Form1.lindex.Caption) * 3 / 2, Curbkcolor
    End If
    End If
    
    If Form1.lindex.Caption >= 7 And Form1.lindex.Caption <= 9 Then
    Line6.x1 = X
    Line6.y2 = Y
    Line6.x2 = X - (Form1.lindex.Caption - 6) * 3
    Line6.y1 = Y - (Form1.lindex.Caption - 6) * 3
    If Button = 1 Then
    Line6.Visible = True
    Picture1.Line (Line6.x1, Line6.y1)-(Line6.x2, Line6.y2), Curcolor
    End If
    If Button = 2 Then
    Line6.Visible = True
    Picture1.Line (Line6.x1, Line6.y1)-(Line6.x2, Line6.y2), Curbkcolor
    End If
    End If
    
    If Form1.lindex.Caption >= 10 And Form1.lindex.Caption <= 12 Then
    Line6.x1 = X
    Line6.y1 = Y
    Line6.x2 = X + (13 - Form1.lindex.Caption) * 3
    Line6.y2 = Y + (13 - Form1.lindex.Caption) * 3
    If Button = 1 Then
    Line6.Visible = True
    Picture1.Line (Line6.x1, Line6.y1)-(Line6.x2, Line6.y2), Curcolor
    End If
    If Button = 2 Then
    Line6.Visible = True
    Picture1.Line (Line6.x1, Line6.y1)-(Line6.x2, Line6.y2), Curbkcolor
    End If
    End If
    
    If Form1.lindex.Caption >= 4 And Form1.lindex.Caption <= 6 Then
    Line6.x1 = X
    Line6.y1 = Y
    Line6.x2 = X + (Form1.lindex.Caption - 3) * 3
    Line6.y2 = Y + (Form1.lindex.Caption - 3) * 3
    If Button = 1 Then
    Line6.Visible = True
    Picture1.Line (Line6.x1, Line6.y1)-(Line6.x2, Line6.y2), Curcolor, BF
    End If
    If Button = 2 Then
    Line6.Visible = True
    Picture1.Line (Line6.x1, Line6.y1)-(Line6.x2, Line6.y2), Curbkcolor, BF
    End If
    End If
    Picture1.FillStyle = 1
    End If


'画线
    If Huabi = 2 Then
    Line1.Visible = True
    Line1.x1 = x1
    Line1.x2 = X
    Line1.y1 = y1
    Line1.y2 = Y
    End If

'矩形和圆的大小
    If Huabi = 4 Or Huabi = 3 Or Huabi = 15 Then
    Shape2.Visible = True
    Shape2.Top = small(y1, Y)
    Shape2.Left = small(x1, X)
    Shape2.Width = Abs(X - x1)
    Shape2.Height = Abs(Y - y1)
    End If
'选择区域的大小
    If Huabi = 6 Then
    Selected = 1
    Line2.x2 = X
    Line2.y2 = Line2.y1
    Line3.y2 = Y
    Line3.x2 = Line2.x1
    Line4.x1 = Line2.x1
    Line4.x2 = Line2.x2
    Line4.y1 = Y
    Line4.y2 = Y
    Line5.x1 = X
    Line5.x2 = X
    Line5.y1 = Line2.y1
    Line5.y2 = Y
    End If
End If
End Sub
'打开新文件后的新属性
Private Sub Picture1_Resize()
Form1.Width = (Picture1.Width) * 15
Form1.Height = (Picture1.Height) * 15
If Form3.Height > Form1.Height Then
Form2.Top = Form3.Height
Else: Form2.Top = Form1.Height
Form2.Width = Form3.Width + Form1.Width
Form2.Line1(0).x2 = Form2.Width
Form2.Line1(1).x2 = Form2.Width
End If
End Sub
'喷枪的timer,在图形框上画随机的点
Private Sub Timer1_Timer()
Me.DrawWidth = 1
    For i = -10 To 10
        For j = -10 To 10
            Form1.Picture1.PSet (nX + Rnd * i * RRR, nY + Rnd * j * RRR), Curcolor
        Next j
    Next i
 End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -