VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "命令按钮例"
   ClientHeight    =   2760
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   2760
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdExit 
      Caption         =   "结束"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3840
      Picture         =   "v6j02-08.frx":0000
      TabIndex        =   4
      ToolTipText     =   "各个"
      Top             =   2280
      Width           =   735
   End
   Begin VB.CommandButton cmdPaste 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3840
      Picture         =   "v6j02-08.frx":0532
      Style           =   1  'Graphical
      TabIndex        =   3
      ToolTipText     =   "粘贴"
      Top             =   1560
      Width           =   735
   End
   Begin VB.CommandButton cmdCopy 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3840
      Picture         =   "v6j02-08.frx":0A64
      Style           =   1  'Graphical
      TabIndex        =   2
      ToolTipText     =   "复制"
      Top             =   840
      Width           =   735
   End
   Begin VB.CommandButton cmdCut 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3840
      Picture         =   "v6j02-08.frx":0F96
      Style           =   1  'Graphical
      TabIndex        =   1
      ToolTipText     =   "剪切"
      Top             =   120
      Width           =   735
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3135
      Left            =   0
      MultiLine       =   -1  'True
      TabIndex        =   0
      Text            =   "v6j02-08.frx":14C8
      Top             =   0
      Width           =   3735
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim st As String

Private Sub cmdCopy_Click()
     st = Text1.SelText   '将选中的内容存放到st变量中
End Sub

Private Sub cmdCut_Click()
    st = Text1.SelText    '将选中的内容存放到st变量中
    Text1.SelText = ""    '将选中的内容清除,实现了剪切
    cmdCopy.Enabled = False
    cmdCut.Enabled = False
    cmdPaste.Enabled = True
End Sub

Private Sub cmdExit_Click()
    End
End Sub

Private Sub cmdPaste_Click()
     ' 将st变量中的内容插入到光标所在的位置,实现了粘贴
    Text1.SelText = st
End Sub

Private Sub Form_Load()         '设置剪切、复制、粘贴按钮无效
   cmdCut.Enabled = False
   cmdCopy.Enabled = False
   cmdPaste.Enabled = False
End Sub

Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Text1.SelText <> "" Then
      cmdCut.Enabled = True     ' 当拖动鼠标选中要操作的文本后,剪切、复制按钮有效
      cmdCopy.Enabled = True
      cmdPaste.Enabled = False
    Else
      cmdCut.Enabled = False    ' 当拖动鼠标未选中文本,剪切、复制按钮无效
      cmdCopy.Enabled = False
      cmdPaste.Enabled = True
    End If
End Sub
