exer56-2.frm

来自「VB6.0应用例题」· FRM 代码 · 共 83 行

FRM
83
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "简单画笔程序"
   ClientHeight    =   2745
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5325
   LinkTopic       =   "Form1"
   ScaleHeight     =   2745
   ScaleWidth      =   5325
   StartUpPosition =   3  '窗口缺省
   Begin VB.Menu mnuPaint 
      Caption         =   "画笔弹出菜单"
      Visible         =   0   'False
      Begin VB.Menu mnuPaintThick 
         Caption         =   "粗笔"
      End
      Begin VB.Menu mnuPaintThin 
         Caption         =   "细笔"
      End
      Begin VB.Menu mnuPaintNormal 
         Caption         =   "标准笔"
         Checked         =   -1  'True
      End
      Begin VB.Menu mnuPaintLine 
         Caption         =   "-"
      End
      Begin VB.Menu mnuPaintExit 
         Caption         =   "退出"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim PaintNow As Boolean
Private Sub Form_Load()
    DrawWidth = 5            '注:设置画点的宽度
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 1 Then
        PaintNow = True      '注:按下鼠标左键时允许绘图
    End If
    If Button = 2 Then
        PopupMenu mnuPaint
    End If

End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If PaintNow Then
        PSet (X, Y)          '注:线条由Pset( )函数所画的点连接而成
    End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    PaintNow = False         '注:放开鼠标按钮时,停止绘图
End Sub

Private Sub mnuPaintExit_Click()
    End
End Sub

Private Sub mnuPaintNormal_Click()
    DrawWidth = 5
    mnuPaintThick.Checked = False
    mnuPaintThin.Checked = False
    mnuPaintNormal.Checked = True
End Sub

Private Sub mnuPaintThick_Click()
    DrawWidth = 8
    mnuPaintThick.Checked = True
    mnuPaintThin.Checked = False
    mnuPaintNormal.Checked = False
End Sub
Private Sub mnuPaintThin_Click()
    DrawWidth = 2
    mnuPaintThick.Checked = False
    mnuPaintThin.Checked = True
    mnuPaintNormal.Checked = False
End Sub

⌨️ 快捷键说明

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