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

📄 formmouse.frm

📁 个人VB学习源码精选,自己学习时的一些编程小程序,希望对大家有帮助
💻 FRM
字号:
VERSION 5.00
Begin VB.Form formMouse 
   BackColor       =   &H00808080&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Mouse Project"
   ClientHeight    =   6300
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6570
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6300
   ScaleWidth      =   6570
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox picColor 
      BackColor       =   &H0000FFFF&
      Height          =   435
      Index           =   4
      Left            =   5940
      ScaleHeight     =   375
      ScaleWidth      =   435
      TabIndex        =   8
      Top             =   5700
      Width           =   495
   End
   Begin VB.PictureBox picColor 
      BackColor       =   &H00FFFFFF&
      Height          =   435
      Index           =   0
      Left            =   3540
      ScaleHeight     =   375
      ScaleWidth      =   435
      TabIndex        =   7
      Top             =   5700
      Width           =   495
   End
   Begin VB.PictureBox picColor 
      BackColor       =   &H00FF0000&
      Height          =   435
      Index           =   3
      Left            =   5340
      ScaleHeight     =   375
      ScaleWidth      =   435
      TabIndex        =   6
      Top             =   5700
      Width           =   495
   End
   Begin VB.PictureBox picColor 
      BackColor       =   &H000000FF&
      Height          =   435
      Index           =   2
      Left            =   4740
      ScaleHeight     =   375
      ScaleWidth      =   435
      TabIndex        =   5
      Top             =   5700
      Width           =   495
   End
   Begin VB.PictureBox picColor 
      BackColor       =   &H00000000&
      Height          =   435
      Index           =   1
      Left            =   4140
      ScaleHeight     =   375
      ScaleWidth      =   435
      TabIndex        =   4
      Top             =   5700
      Width           =   495
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "E&xit"
      Height          =   375
      Left            =   1500
      TabIndex        =   2
      Top             =   5760
      Width           =   915
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "&Clear"
      Height          =   375
      Left            =   360
      TabIndex        =   1
      Top             =   5760
      Width           =   915
   End
   Begin VB.PictureBox picCanvas 
      Height          =   5475
      Left            =   120
      ScaleHeight     =   5415
      ScaleWidth      =   6255
      TabIndex        =   0
      Top             =   60
      Width           =   6315
   End
   Begin VB.Label lblCurrentColor 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      Caption         =   "·"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2760
      TabIndex        =   3
      Top             =   5640
      Width           =   495
   End
End
Attribute VB_Name = "formMouse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private DrawOn As Integer
Private StartX As Single
Private StartY As Single
Private LastY As Single
Private LastX As Single

Private SaveColor As Single

Private Sub cmdClear_Click()
    picCanvas.Cls
End Sub

Private Sub cmdExit_Click()
    End
End Sub

Private Sub picCanvas_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DrawOn = True
    StartX = X
    StartY = Y
End Sub

Private Sub picCanvas_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If DrawOn Then
        If Button And vbLeftButton Then
            picCanvas.Line (LastX, LastY)-(X, Y)
        Else
            If Button And vbRightButton Then
                If Shift And vbShiftMask Then picCanvas.Line (StartX, StartY)-(X, Y), , B
            End If
            picCanvas.Line (StartX, StartY)-(X, Y)
        End If
    End If
    LastX = X
    LastY = Y
End Sub

Private Sub picCanvas_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DrawOn = False
    StartX = 0
    StartY = 0
End Sub

Private Sub picColor_Click(Index As Integer)
    SaveColor = picCanvas.ForeColor
    picCanvas.ForeColor = picColor(Index).BackColor
    lblCurrentColor.ForeColor = picColor(Index).BackColor
End Sub

Private Sub picColor_DblClick(Index As Integer)
picCanvas.ForeColor = SaveColor
lblCurrentColor.ForeColor = SaveColor
picCanvas.BackColor = picColor(Index).BackColor
lblCurrentColor.BackColor = picColor(Index).BackColor
End Sub

⌨️ 快捷键说明

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