⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c++ builder 程序设计实用教程 - 1_4 快速利用向导 - 张晋 - 17xie.htm

📁 已经消失的不易找到的C++ builder网络教程总结
💻 HTM
📖 第 1 页 / 共 4 页
字号:
style="FONT-FAMILY: 楷体_GB2312; mso-ascii-font-family: 'Times New Roman'">.运行程序</SPAN></H4>
<P class=MsoNormalIndent><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">做完以上的工作后,选择菜单</SPAN><SPAN 
lang=EN-US>File</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的</SPAN><SPAN 
lang=EN-US>Save All</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项,在弹出的对话框中选择合适的文件名保存文件,然后按键盘上的功能键</SPAN><SPAN 
lang=EN-US>F9</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">运行程序,程序的运行的结果如图</SPAN><SPAN 
lang=EN-US>1-16</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所示。</SPAN></P>
<P class=a><SPAN lang=EN-US><IMG height=226 
src="C++ Builder 程序设计实用教程 - 1_4 快速利用向导 - 张晋 - 17xie.files/5df52798ac.jpg" 
width=308 v:shapes="_x0000_i1031"></SPAN></P>
<P class=MsoCaption><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">图</SPAN><SPAN 
lang=EN-US>1-16<SPAN style="mso-spacerun: yes">&nbsp; </SPAN></SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">程序运行结果</SPAN></P>
<P class=MsoNormalIndent><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但是在这个应用程序中,用于还没有添加各个事件的响应代码,所以它的程序功能还不是很完善,但是它为我们生成了一个标准的程序框架,用户可以在此基础上添加自己的代码。</SPAN></P>
<P class=MsoNormalIndent><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">由向导生成的程序完整源代码如下所示:</SPAN></P>
<P class=MsoNormalIndent><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormalIndent><SPAN lang=EN-US><o:p>&nbsp;</o:p></SPAN></P>
<DIV 
style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-element: para-border-div">
<P class=a0 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 0cm; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 1.0pt 4.0pt 1.0pt 4.0pt"><SPAN 
style="FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: 'Times New Roman'">程序清单</SPAN></P></DIV>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">#include 
&lt;vcl\vcl.h&gt;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">#pragma 
hdrstop<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">#include 
"Main.h"<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">#pragma 
resource "*.dfm"<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">TMainForm 
*MainForm;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">__fastcall 
TMainForm::TMainForm(TComponent* Owner)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>: TForm(Owner)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FormCreate(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>Application-&gt;OnHint = ShowHint;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::ShowHint(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>StatusLine-&gt;SimpleText = Application-&gt;Hint;<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FileNew(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>//--- Add code to create a new file ---<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FileOpen(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>if (OpenDialog-&gt;Execute())<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>//---- Add code to open OpenDialog-&gt;FileName 
----<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FileSave(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>//---- Add code to save current file under current name 
----<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FileSaveAs(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>if (SaveDialog-&gt;Execute())<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>//--- Add code to save current file under SaveDialog-&gt;FileName 
---<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FilePrint(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>if (PrintDialog-&gt;Execute())<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>//---- Add code to print current file ----<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FilePrintSetup(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>PrintSetupDialog-&gt;Execute();<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::FileExit(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>Close();<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TMainForm::EditUndo(TObject *Sender)<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US style="FONT-FAMILY: 'Times New Roman'"><SPAN 
style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
</SPAN>//---- Add code to perform Edit Undo ----<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//-----------------------------------------------------------------------<o:p></o:p></SPAN></P>
<P class=a1><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"><o:p>&nbsp;</o:p></SPAN></P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -