用VB程序编写设计一个简易记事本,要求能够实现“复制”、“剪切”、“粘贴”、“退出”功能

 我来答
独自落泪的鱼
2011-03-12
知道答主
回答量:8
采纳率:0%
帮助的人:0
展开全部
Dim sFind As String
Dim FileType, FilterType As String
Private Sub Form_Load()
Me.Height = 6000
Me.Width = 9000
End Sub

Private Sub Form_Resize()
On Error Resume Next
RichTextBox1.Top = 5
RichTextBox1.Left = 5
RichTextBox1.Height = ScaleHeight - 40
RichTextBox1.Width = ScaleWidth - 40

End Sub

Private Sub mnuALL_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
End Sub

Private Sub mnuCopy_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText

End Sub

Private Sub mnuCut_Click()
Clipboard.Clear
Clipboard.SetText RichTextBox1.SelText
RichTextBox1.SelText = ""
End Sub

Private Sub mnuExit_Click()
End
End Sub

Private Sub mnuFind_Click()
sFind = InputBox("请输入要查找的字符", "查找")
RichTextBox1.Find sFind

End Sub

Private Sub mnuFindNext_Click()
RichTextBox1.SelStart = RichTextBox1.SelStart + RichTextBox1.SelLength + 1
RichTextBox1.Find sFind, , RichTextBox1

End Sub

Private Sub mnuNew_Click()
RichTextBox1.Text = ""
FileName = "未命名"
Me.Caption = FileName
End Sub

Private Sub mnuOpen_Click()
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|rtf文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowOpen
FileName = CommonDialog1.FileName
RichTextBox1.Text = ""
RichTextBox1.LoadFile FileName
Me.Caption = "超级记事本:" & FileName

End Sub

Private Sub mnuPaste_Click()
RichTextBox1.SelText = Clipboard.GetText
End Sub

Private Sub mnuSvae_Click()
CommonDialog1.Filter = "文本文档(*.txt)|*.txt|rtf文档(*.rtf)|*.rtf|所有文件(*.*)|*.*"
CommonDialog1.ShowSave
FileType = CommonDialog1.FileTitle
FilterType = LCase(Right(FileType, 3))
FileName = CommonDialog1.FileName
Select Case FilterType
Case "txt"
RichTextBox1.SaveFile FileName, rtfText
Case "rtf"
RichTextBox1.SaveFile FileName, rtfRTF
Case "*.*"
RichTextBox1.SaveFile FileName
End Select
Me.Caption = "超级记事本:" & FileName
End Sub
这是全部代码,如果楼主有需要。我可以将整个工程文件发到你邮箱
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式