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

📄 c++ builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.htm

📁 已经消失的不易找到的C++ builder网络教程总结
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0044)http://www.17xie.com/read.php?bid=303&seq=23 -->
<HTML xmlns:st1 xmlns:o><HEAD><TITLE>C++ Builder 程序设计实用教程 - 3.1.1 对话框函数简介 - 张晋 - 17xie</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8"><LINK 
href="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/17xie.css" 
type=text/css rel=stylesheet><LINK 
href="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/read.css" 
type=text/css rel=stylesheet>
<SCRIPT src="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/core.js" 
type=text/javascript></SCRIPT>

<SCRIPT src="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/iframe.js" 
type=text/javascript></SCRIPT>

<SCRIPT src="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/dialog.js" 
type=text/javascript></SCRIPT>

<SCRIPT src="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/ajax.js" 
type=text/javascript></SCRIPT>

<SCRIPT src="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/cookie.js" 
type=text/javascript></SCRIPT>

<META content="MSHTML 6.00.2900.3020" name=GENERATOR></HEAD>
<BODY>
<DIV id=m-body>
<DIV id=read-top>
<DIV style="FLOAT: left"><A href="http://www.17xie.com/" target=_blank><IMG 
src="C++ Builder 程序设计实用教程 - 3_1_1 对话框函数简介 - 张晋 - 17xie.files/booklogo.gif"></A></DIV>
<DIV id=read-menu><NOBR><A 
onclick="APIframe.open('快速登录','/m/user/poplogin.php',400,160)" 
href="javascript:void(0)">登录</A> <A 
onclick="APIframe.open('17xie-快速注册','/m/user/reg.php',480,460)" 
href="javascript:void(0)">注册</A> | <A href="http://www.17xie.com/" 
target=_blank>首页</A> <A href="http://www.17xie.com/bbs/index.php?ishow=y" 
target=_blank>论坛</A> <A href="http://www.17xie.com/user.php" 
target=_blank>会员中心</A> <A href="http://www.17xie.com/help/" 
target=_blank>帮助</A></NOBR></DIV></DIV>
<DIV id=read-title>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: left; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><A 
href="http://www.17xie.com/" target=_blank>17xie</A> &gt; <A 
href="http://www.17xie.com/book.php?bid=303">C++ Builder 程序设计实用教程</A> &gt; 3.1.1 
对话框函数简介</DIV>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: right; PADDING-BOTTOM: 0px; PADDING-TOP: 4px"><INPUT class=button-red8 onclick="window.location.href='/m/book/write.php?pid=5530'" type=button value=点击编辑本页></DIV></DIV>
<DIV id=read-mpage>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: left; PADDING-BOTTOM: 8px; PADDING-TOP: 8px">背景: 
<SPAN class=chcolor style="BACKGROUND-COLOR: #eeeeff" 
onclick="chcolor('#eeeeff')">&nbsp;&nbsp;</SPAN> <SPAN class=chcolor 
style="BACKGROUND-COLOR: #ffeeee" 
onclick="chcolor('#ffeeee')">&nbsp;&nbsp;</SPAN> <SPAN class=chcolor 
style="BACKGROUND-COLOR: #eeffee" 
onclick="chcolor('#eeffee')">&nbsp;&nbsp;</SPAN> <SPAN class=chcolor 
style="BACKGROUND-COLOR: #ffffee" 
onclick="chcolor('#ffffee')">&nbsp;&nbsp;</SPAN> <SPAN class=chcolor 
style="BACKGROUND-COLOR: #eeeeee" 
onclick="chcolor('#eeeeee')">&nbsp;&nbsp;</SPAN> <SPAN class=chcolor 
style="BACKGROUND-COLOR: #ffffff" 
onclick="chcolor('#ffffff')">&nbsp;&nbsp;</SPAN> </DIV>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: right; PADDING-BOTTOM: 0px; PADDING-TOP: 3px">
<TABLE>
  <TBODY>
  <TR>
    <TD><NOBR><SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=1'">|&lt;</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=22'">上一页</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=20'">20</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=21'">21</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=22'">22</SPAN> 
      <SPAN class=page-here 
      onclick="window.location.href='/read.php?bid=303&amp;seq=23'">23</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=24'">24</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=25'">25</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=26'">26</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=24'">下一页</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=105'">&gt;|</SPAN></NOBR>.</TD>
    <TD><INPUT class=input-text 
      onkeydown='if(window.event.keyCode==13)window.location.href="/read.php?bid=303&amp;seq="+this.value' 
      style="WIDTH: 25px"></TD>
    <TD style="PADDING-TOP: 2px">[共105页]</TD></TR></TBODY></TABLE></DIV></DIV>
<DIV id=read-conts style="BACKGROUND-COLOR: #ffffff"><SPAN 
style="FONT-SIZE: 12px">本页字数:2622&nbsp;&nbsp;&nbsp;&nbsp;最后更新:<NOBR>12天以前</NOBR> 
<NOBR>[11-30 11:33]</NOBR> 由 <A onclick='$showu(1271,"张晋")' 
href="javascript:void(0)">张晋</A> 编辑&nbsp;&nbsp;&nbsp;&nbsp;<A class=aline 
style="COLOR: red" href="http://www.17xie.com/m/user/inviter_reg.php" 
target=_blank>注册17xie 一起来写书 实现您的出书梦想!</A></SPAN> 
<HR>

<CENTER>
<DIV style="WIDTH: 547px; TEXT-ALIGN: left">
<DIV class=Section1 style="LAYOUT-GRID:  15.6pt none">
<H3><A name=_Toc502915222></A><A name=_Toc499459650></A><A 
name=_Toc496446570></A><A name=_Toc496438698></A><st1:chsdate Year="1899" 
Month="12" Day="30" IsLunarDate="False" IsROCDate="False" w:st="on"><SPAN 
style="mso-bookmark: _Toc496438698"><SPAN 
style="mso-bookmark: _Toc496446570"><SPAN 
style="mso-bookmark: _Toc499459650"><SPAN 
style="mso-bookmark: _Toc502915222"><SPAN 
lang=EN-US>3.1.1</SPAN></SPAN></SPAN></SPAN></SPAN></st1:chsdate><SPAN 
style="mso-bookmark: _Toc496438698"><SPAN 
style="mso-bookmark: _Toc496446570"><SPAN 
style="mso-bookmark: _Toc499459650"><SPAN 
style="mso-bookmark: _Toc502915222"><SPAN lang=EN-US><SPAN 
style="mso-spacerun: yes">&nbsp; </SPAN></SPAN></SPAN></SPAN></SPAN></SPAN><SPAN 
style="mso-bookmark: _Toc496438698"><SPAN 
style="mso-bookmark: _Toc496446570"><SPAN 
style="mso-bookmark: _Toc499459650"><SPAN 
style="mso-bookmark: _Toc502915222"><SPAN 
style="FONT-FAMILY: 黑体; mso-ascii-font-family: 'Times New Roman'">对话框函数简介</SPAN></SPAN></SPAN></SPAN></SPAN></H3>
<P class=MsoNormal><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>CBuilder</SPAN></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>ShowMessage</SPAN></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>MessageDlg</SPAN></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>InputBox</SPAN></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></P>
<H4><SPAN lang=EN-US style="mso-font-kerning: 1.0pt">1</SPAN><SPAN 
style="FONT-FAMILY: 楷体_GB2312; mso-ascii-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt">.</SPAN><SPAN 
class=SpellE><SPAN lang=EN-US>ShowMessage</SPAN></SPAN><SPAN 
lang=EN-US>()</SPAN><SPAN 
style="FONT-FAMILY: 楷体_GB2312; mso-ascii-font-family: 'Times New Roman'">函数</SPAN></H4>
<P class=MsoNormal><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>ShowMessage</SPAN></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></P>
<P class=MsoNormal><SPAN class=SpellE><SPAN 
lang=EN-US>ShowMessage</SPAN></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></P>
<P class=a0><SPAN class=SpellE><SPAN class=GramE><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">ShowMessage</SPAN></SPAN></SPAN><SPAN 
class=GramE><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">(</SPAN></SPAN><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">const <SPAN class=SpellE>Msg</SPAN>: 
string);<o:p></o:p></SPAN></P>
<P class=MsoNormal><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>2</SPAN><SPAN 
style="FONT-FAMILY: 楷体_GB2312; mso-ascii-font-family: 'Times New Roman'">.开始工作</SPAN></H4>
<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>Hello</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=MsoNormal><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在程序的设计过程中用鼠标的左键双击窗体上的按钮控件,在屏幕上就会弹出一个代码窗口,在其中添加如下所示的按钮响应代码:</SPAN></P>
<P class=a0><SPAN class=GramE><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">char</SPAN></SPAN><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"> *string;<o:p></o:p></SPAN></P>
<P class=a0><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">//</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="FONT-FAMILY: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=a0><SPAN class=GramE><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">void</SPAN></SPAN><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'"> __<SPAN class=SpellE>fastcall</SPAN> 
TForm1::Button1Click(<SPAN class=SpellE>TObject</SPAN> 
*Sender)<o:p></o:p></SPAN></P>
<P class=a0><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">{<o:p></o:p></SPAN></P>
<P class=a0><SPAN class=SpellE><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">str</SPAN></SPAN><SPAN lang=EN-US 

⌨️ 快捷键说明

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