【#第一文档网# 导语】以下是®第一文档网的小编为您整理的《VB里关于复制、粘贴的代码》,欢迎阅读!
Private Sub Copy_Click() Clipboard.SetText Text1.SelText Paste.Enabled = True End Sub Private Sub Cut_Click() Clipboard.SetText Text1.SelText Text1.SelText = "" End Sub Private Sub Paste_Click() Text1.SelText = Clipboard.GetText End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As MSComCtlLib.Button) On Error Resume Next Select Case Button.Key Case "新建" new_Click '应做:添加 '新建' 按钮代码。 Case "保存" save_Click Case "复制" Copy_Click Case "剪切" Cut_Click Case "粘贴" Paste_Click Case "粗体" Text1.FontBold = True '应做:添加 '粗体' 按钮代码。 Case "斜体" Text1.FontItalic = True '应做:添加 '斜体' 按钮代码。 Case "下划线" Text1.FontUnderline = True '应做:添加 '下划线' 按钮代码。 End Select End Sub Private Sub BackColor_Click() Cmd.Action = 3 Text1.BackColor = Cmd.Color End Sub Private Sub end_Click() End End Sub Private Sub ForeColor_Click() Cmd.Action = 3 Text1.ForeColor = Cmd.Color End Sub Private Sub HT_Click() Text1.FontName = "黑体" End Sub Private Sub JRead_Click() JRead.Checked = True End Sub Private Sub KS_Click() Text1.FontName = "楷体_GB2312" End Sub Private Sub LS_Click() Text1.FontName = "隶书" End Sub Private Sub new_Click() Text1.Text = "" End Sub Private Sub save_Click() Cmd.Filter = "文本文件(*.txt)|*.txt|源程序(*.asm)|*.asm|所有文件|*.*|" Cmd.ShowSave If Cmd.FileName = "" Then Exit Sub End If Open Cmd.FileName For Output As #1 Print #1, Text1.Text Close #1 End Sub Private Sub SaveAs_Click() Cmd.Filter = "文本文件(*.txt)|*.txt|源程序(*.asm)|*.asm|所有文件|*.*|" Cmd.ShowSave If Cmd.FileName = "" Then Exit Sub End If Open Cmd.FileName For Output As #1 Print #1, Text1.Text Close #1 End Sub Private Sub Showl1_Click() If Showl1.Caption = "显示" Then Showl1.Caption = "隐藏" Text1.Visible = False ElseIf Showl1.Caption = "隐藏" Then Showl1.Caption = "显示" Text1.Visible = True End If End Sub Private Sub ST_Click() Text1.FontName = "宋体" End Sub 本文来源:https://www.dywdw.cn/7eb00a53f01dc281e53af069.html