📄 c++ builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.htm
字号:
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在如图</SPAN><SPAN
lang=EN-US>7-2</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所示的选择数据库类型的对话框中,用户可以对窗体的类型和数据控件类型进行选择,用户可以选择如下类型的窗体:创建一个简单的窗体或创建一个主</SPAN><SPAN
lang=EN-US>/</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">细节窗体;同时用户还可以选择如下的数据控件:创建的窗体中包含</SPAN><SPAN
class=SpellE><SPAN lang=EN-US>Tabel</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件或创建的窗体中包括</SPAN><SPAN
lang=EN-US>Query</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=207
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/f16ecdd269.jpg"
width=320 v:shapes="_x0000_i1026"></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>7-2<SPAN style="mso-spacerun: yes"> </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><SPAN
lang=EN-US>Create a simple form</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</SPAN><SPAN
lang=EN-US>Create a form using <SPAN class=SpellE>TTable</SPAN>
objects</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项,即创建一个包含</SPAN><SPAN
lang=EN-US>Table</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件的简单窗体。单击</SPAN><SPAN
lang=EN-US>Next</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按钮进入下一步。</SPAN></P>
<H4><SPAN lang=EN-US>3</SPAN><SPAN
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>7-3</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=207
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/d325d4f196.jpg"
width=320 v:shapes="_x0000_i1027"></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>7-3<SPAN style="mso-spacerun: yes"> </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><SPAN
lang=EN-US>E:\C++Builder\Borland Shared\Data\<SPAN
class=SpellE>animals.db</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,单击</SPAN><SPAN
lang=EN-US>Next</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按钮进入下一步。</SPAN></P>
<H4><SPAN lang=EN-US>4</SPAN><SPAN
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>7-4</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">所示的对话框中,用户可以选择在程序运行过程中想要显示的域,单击</SPAN><SPAN
lang=EN-US style="mso-font-kerning: 0pt; mso-no-proof: yes"><IMG height=16
src="" width=21 v:shapes="_x0000_i1028"> </SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">按钮</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">可以向窗体中添加选中的域,而单击</SPAN><SPAN
style="mso-font-kerning: 0pt"> <SPAN lang=EN-US style="mso-no-proof: yes"><IMG
height=16 src="" width=21 v:shapes="_x0000_i1029"><SPAN
style="mso-spacerun: yes"> </SPAN></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">则可以添加所有的域,同样单击</SPAN><SPAN
style="mso-font-kerning: 0pt; mso-no-proof: yes"> <SPAN lang=EN-US><IMG
height=16 src="" width=21 v:shapes="_x0000_i1030"><SPAN
style="mso-spacerun: yes"> </SPAN></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">按钮和</SPAN><SPAN
style="mso-font-kerning: 0pt; mso-no-proof: yes"> <SPAN lang=EN-US><IMG
height=16
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/ce0a9635da.jpg"
width=21 v:shapes="_x0000_i1031"><SPAN
style="mso-spacerun: yes"> </SPAN></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt; mso-no-proof: yes">可以删除已经添加的域。</SPAN></P>
<P class=a><SPAN lang=EN-US><IMG height=222
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/298e42cd0c.jpg"
width=344 v:shapes="_x0000_i1032"></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>7-4<SPAN style="mso-spacerun: yes"> </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><SPAN
lang=EN-US>Next</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按钮进入下一步。</SPAN></P>
<H4><SPAN lang=EN-US>5</SPAN><SPAN
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>7-5</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=222
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/7eeedde46e.jpg"
width=344 v:shapes="_x0000_i1033"></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>7-5<SPAN style="mso-spacerun: yes"> </SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择布局样式对话框</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果在选择窗体布局样式对话框中选择的是</SPAN><SPAN
lang=EN-US>Horizontally</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式,那么窗体上的控件将会以水平方式对齐,如果选择的是</SPAN><SPAN
lang=EN-US>Vertically</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式,那么窗体上的控件将会以垂直方式排列。</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果选择的是</SPAN><SPAN
lang=EN-US>In a grid</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,那么在中将会使用</SPAN><SPAN
class=SpellE><SPAN lang=EN-US>DBGird</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控件。</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在本示例程序中选择</SPAN><SPAN
lang=EN-US>Horizontally</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式,单击</SPAN><SPAN
lang=EN-US>Next</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按钮进入下一步。</SPAN></P>
<H4><SPAN lang=EN-US>6</SPAN><SPAN
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>7-6</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 lang=EN-US><o:p> </o:p></SPAN></P>
<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>Generate a main form</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">来决定在项目中是否加入一个主窗体。同时用户还可以选择</SPAN><SPAN
lang=EN-US>Form Only</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">或者</SPAN><SPAN
lang=EN-US>Form and <SPAN class=SpellE>DataModule</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,如果选择</SPAN><SPAN
lang=EN-US>Form Only</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项,那么在项目中将只包括一个窗体,所有的控件都会放置在一个窗体中,如果选择</SPAN><SPAN
lang=EN-US>Form and <SPAN class=SpellE>DataModule</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选项,那么控件将会分别的放置在</SPAN><SPAN
lang=EN-US>2</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">个窗体中。完成以上的工作后,单击</SPAN><SPAN
lang=EN-US>Finish</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">按钮,就创建了一个简单的数据库应用程序,完成后的窗体如图</SPAN><SPAN
lang=EN-US>7-7</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=219
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/b412fe2dc9.jpg"
width=338 v:shapes="_x0000_i1034"></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>7-6<SPAN style="mso-spacerun: yes"> </SPAN></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=285
src="C++ Builder 程序设计实用教程 - 7_1 使用数据库向导 - 张晋 - 17xie.files/4566bc75f1.jpg"
width=314 v:shapes="_x0000_i1035"></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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -