form1.frm

来自「这里有很多很实用的VB编程案例,方便大家学习VB.」· FRM 代码 · 共 139 行

FRM
139
字号
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   BackColor       =   &H8000000A&
   Caption         =   "调色板"
   ClientHeight    =   2370
   ClientLeft      =   4140
   ClientTop       =   1770
   ClientWidth     =   3735
   Icon            =   "form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   2370
   ScaleWidth      =   3735
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "&Copy"
      Height          =   375
      Left            =   2280
      TabIndex        =   6
      Top             =   120
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Cancel          =   -1  'True
      Caption         =   "&End"
      Height          =   375
      Left            =   2280
      TabIndex        =   5
      Top             =   1080
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H8000000A&
      Caption         =   "Reset"
      Height          =   375
      Left            =   2280
      TabIndex        =   4
      Top             =   600
      Width           =   1335
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   2640
      Top             =   1680
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton Command4 
      Caption         =   "打开调色板"
      Default         =   -1  'True
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   1575
   End
   Begin VB.Label lblVis 
      Alignment       =   2  'Center
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   1080
      Width           =   1815
   End
   Begin VB.Label lblVisFarge 
      BorderStyle     =   1  'Fixed Single
      Height          =   375
      Left            =   240
      TabIndex        =   2
      Top             =   1680
      Width           =   1815
   End
   Begin VB.Label lblInfo1 
      Caption         =   "code:"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Width           =   1815
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit



Private Sub Command3_Click()
    End
End Sub

Private Sub Command4_Click()
    On Error Resume Next
    With CommonDialog1
        .Flags = cdlCCFullOpen
        .ShowColor
    End With
    lblVis.Caption = CommonDialog1.Color
    lblVisFarge.BackColor = lblVis.Caption
End Sub

Private Sub Command1_Click()
    On Error Resume Next
    If lblVis = "" Then
        MsgBox Prompt:="你没有选择颜色。", _
        Buttons:=vbOKOnly + vbExclamation + vbDefaultButton1, _
        Title:="调色板"
    Else
        Clipboard.Clear
        Clipboard.SetText lblVis.Caption
        MsgBox Prompt:="代码已经复制。", _
        Buttons:=vbOKOnly + vbInformation + vbDefaultButton1, _
        Title:="调色板"
    End If
End Sub

Private Sub Command2_Click()
    On Error Resume Next
    lblVis.Caption = ""
    With lblVisFarge
        .BackColor = &H8000000A
        .Caption = ""
    End With
End Sub

⌨️ 快捷键说明

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