6.20.frm

来自「vb编程+从基础到实践光盘代码」· FRM 代码 · 共 44 行

FRM
44
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
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                '在窗体层定义布尔型变量PaintNow

Private Sub Form_DblClick()
    Cls                                '双击窗体清除所画内容
End Sub

Private Sub Form_Load()
    DrawWidth = 2                      '线条宽度
    ForeColor = RGB(0, 0, 255)         '设置蓝色为画图颜色
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
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If PaintNow Then
        PSet (X, Y)                    '画一个点
    End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    PaintNow = False                   '禁止画图
End Sub

⌨️ 快捷键说明

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