【正文】
,“確定”按鈕。在窗體上繪制 RichText Box,其大小和位置可不用理睬,我們將在代碼中處理,為了在打開和編輯文件時(shí)有垂直滾動(dòng)條,可以把它的 ScrollBar 屬性設(shè)為 2rtfVertical。 ③ 參考教材第五章的內(nèi)容,編寫程序代碼。請(qǐng)按上述方法添加。在程序界面上添加 它,然后右鍵單擊此控件,左鍵單擊“屬性”,彈出“屬性頁”對(duì)話框的“圖像”,再單擊“插入圖片”就可以一次性裝載圖片了(如不滿意,以后還可以添加)。在插入圖片時(shí)給每一張圖片注明關(guān)鍵字,以便在引用圖片時(shí)不至于混亂。 8 圖片有了,接下來在程序界面添加工具欄 (ToolBar)。按鈕有多種樣式,請(qǐng)根據(jù)需要設(shè)置。 ⑶ 編寫工具欄的按鈕代碼:工具欄按鈕的代碼編輯很簡單,可以按照下面的格式去編寫: Private Sub ToolBar1_ButtonClick(ByVal Button As ) On Error Resume Next 39。按關(guān)鍵字選擇 Case 新建 mnuNew_Click 39。等于菜單項(xiàng)“打開”被單擊 mnuOpen_Click 39。 在編碼時(shí),注意代碼的書寫規(guī)范,包括命名慣例、注釋、分隔和縮進(jìn)等,這樣使程序?qū)哟吻逦?,增?qiáng) 可讀性和可維護(hù)性。 9 運(yùn)行結(jié)果 運(yùn)行結(jié)果及部分 運(yùn)行界面截圖如下: 圖 41 初始狀態(tài) 圖 42 替換 操作 10 圖 43 查找操作 11 第五章 課程設(shè)計(jì)心得與體會(huì) 步入大學(xué),我們接觸到了更多的計(jì)算機(jī)專業(yè)知識(shí)。而這學(xué)期的課程設(shè)計(jì),對(duì)我來說是一個(gè)新的挑戰(zhàn)。 在老師剛布置下來任務(wù)之后,我便開始在網(wǎng)上和圖書管理搜集資料,雖然關(guān)于這方面的資料很多,但是好多都和我的不相匹配。然后,看懂了是一方面,自己動(dòng)手做,又是另一個(gè)挑戰(zhàn)。于是,我又把資料仔細(xì)的閱讀,并詢問老師和同學(xué)們,再加上自己的摸索,最終提早完成了任務(wù)。 在編寫過程中也有許多小問題,比如沒有定義,缺少符號(hào)等等,但經(jīng)過仔細(xì)的修改以及尋求別人的幫助把問題也改正了,大多數(shù)是因?yàn)樽约旱拇中亩鸬?。在學(xué)習(xí)理論知識(shí)的同時(shí)也要參加實(shí)踐活動(dòng),把課本上的知識(shí)運(yùn)動(dòng)到實(shí)踐當(dāng)中去,也是我們學(xué)習(xí)專業(yè)理論知識(shí)的最終目的 。 在今后的學(xué)習(xí)過程中我們會(huì)更加努力。 endif ///////////////////////////////////////////////////////////////////////////// // CMyApp BEGIN_MESSAGE_MAP(CMyApp, CWinApp) //{{AFX_MSG_MAP(CMyApp) ON_COMMAND(ID_APP_ABOUT, OnAppAbout) // NOTE the ClassWizard will add and remove mapping macros here. // DO NOT EDIT what you see in these blocks of generated code! //}}AFX_MSG_MAP // Standard file based document mands ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) // Standard print setup mand ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMyApp construction CMyApp::CMyApp() { // TODO: add construction code here, // Place all significant initialization in InitInstance } ///////////////////////////////////////////////////////////////////////////// 14 // The one and only CMyApp object CMyApp theApp。 // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need. ifdef _AFXDLL Enable3dControls()。 // Call this when linking to MFC statically endif // Change the registry key under which our settings are stored. // TODO: You should modify this string to be something appropriate // such as the name of your pany or anization. SetRegistryKey(_T(Local AppWizardGenerated Applications))。 // Load standard INI file options (including MRU) // Register the application39。 pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CMyDoc), RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CMyView))。 // Parse mand line for standard shell mands, DDE, file open CCommandLineInfo cmdInfo。 // Dispatch mands specified on the mand line if (!ProcessShellCommand(cmdInfo)) return FALSE。 m_pMainWndUpdateWindow()。 } ///////////////////////////////////////////////////////////////////////////// // CAboutDlg dialog used for App About class CAboutDlg : public CDialog { public: CAboutDlg()。 //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(C