新文件
私有Sub mnuNew_Click()
RichTextBox1。Text = " " '清空文本框。
FileName = "未命名"
我。標題=文件名
末端接頭
打開文件
私有Sub mnuOpen _ Click()
CommonDialog1。Filter= "文本文檔(*。txt) *。txt RTF文檔(*。rtf) *。所有文件(*。*) *.*"
CommonDialog1。ShowOpen
RichTextBox1。Text = " " '清空文本框。
FileName = CommonDialog1。文件名
RichTextBox1。加載文件文件名
我。Caption = "超級記事本:" &;文件名
末端接頭
保存文件
私有Sub mnuSave_Click()
CommonDialog1。Filter= "文本文檔(*。txt) *。txt RTF文檔(*。rtf) *。所有文件(*。*) *.*"
CommonDialog1。顯示保存
FileType = CommonDialog1。文件標題
fittype = LCase(center(FileType,3))
FileName = CommonDialog1。文件名
選擇案例類型
案例“文本”
RichTextBox1。保存文件文件名,rtfText
案例“rtf”
RichTextBox1。保存文件文件名,rtfRTF
案例" *。*"
RichTextBox1。保存文件文件名
結束選擇
我。Caption = "超級記事本:" &;文件名
末端接頭
放棄
私有Sub mnuExit_Click()
結束
末端接頭
復制
私有Sub mnuCopy_Click()
剪貼板。清楚的
剪貼板。SetText RichTextBox1。SelText
末端接頭
切口
私有Sub mnuCut_Click()
剪貼板。清楚的
剪貼板。SetText RichTextBox1。SelText
RichTextBox1。SelText = " "
末端接頭
全選
私有Sub mnuSelectAll_Click()
RichTextBox1。SelStart = 0
RichTextBox1。SelLength = Len(rich textbox 1。正文)
末端接頭
粘貼
私有Sub mnuPaste_Click()
RichTextBox1。SelText =剪貼板。GetText
末端接頭
發現
私有Sub mnuFind_Click()
SFind = InputBox("請輸入要查找的單詞:","查找什麽",SFind)。
RichTextBox1。查找sFind
末端接頭
繼續找。
私有Sub mnuFindOn_Click()
RichTextBox1。SelStart = RichTextBox1。SelStart+RichTextBox1。SelLength + 1
RichTextBox1。查找sFind,,Len(RichTextBox1)
末端接頭
使用說明
私有子目錄_Click()
出錯時轉到處理程序
rich textbox 1 . loadfile " Readme.txt ",rtfttext '請編寫readme . txt文件並保存在程序所在的文件夾中。
我。Caption = "超級記事本:" &;“使用說明”
出口接頭
處理人:
MsgBox "說明文件可能已被刪除,請聯系作者。",vbOKOnly,“錯誤消息”
末端接頭
VC++編程方法:
首先用VC++創建壹個MFC AppWizard(exe)單文檔項目,命名為Notepad。在Advanced中的文件擴展名中寫txt是壹個關聯的txt文件,在Base class中選擇CEditView類(意思是妳使用的類就是從這個類派生出來的)。
其實生成的筆記本是筆記本,但還是和原來的筆記本不壹樣。
所以我們需要增加壹些功能,讓新人了解VC++。
1,我們先加壹個設置字體。
在CNotepadView類中定義字體(即public)CFont m _ Font;
定義消息處理功能:
void CNotepadView::OnFormatFont()
{
// TODO:在此添加命令處理程序代碼
LOGFONT lf
CFont * font = this-& gt;GetEditCtrl()。get font();
if(font==NULL)
{
font =new CFont。
字體-& gt;CreatePointFont(120," fixed sys ");
字體-& gt;GetLogFont(& amp;lf);
刪除字體;
}
其他
{
字體-& gt;GetLogFont(& amp;lf);
}
CFontDialog cf(& amp;lf);
if(參見DoModal()==IDOK)
{
這-& gt;m_Font。delete object();
這-& gt;m_Font。createfont indirect(& amp;lf);
這-& gt;set font(& amp;這-& gt;m _ Font);
}
}
2、設置字體
在CNotepadView類中定義BOOL bChk
消息處理功能
void CNotepadView::onformatreurn()
{
// TODO:在此添加命令處理程序代碼
bChk=!bChk
如果(!bChk)
{
ShowScrollBar(SB_HORZ,true);
}
其他
{
ShowScrollBar(SB_HORZ,false);
}
}
以下是RAR壓縮包的源代碼
/Notepad.rar
黑客動畫記事本源代碼不會輕易公開,而且記事本不太好,界面也不好。其實很容易破解,但意義不大。