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

📄 c++ builder 程序设计实用教程 - 3_2_1 菜单及其概述 - 张晋 - 17xie.htm

📁 已经消失的不易找到的C++ builder网络教程总结
💻 HTM
📖 第 1 页 / 共 5 页
字号:
lang=EN-US>FormCreate()</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 lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TForm1::FormCreate(TObject *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 lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">Form1-&gt;Copy1-&gt;Enabled=true;<o:p></o:p></SPAN></P>
<P class=a0><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">Form1-&gt;Paste1-&gt;Enabled=false;<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 lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<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=MsoNormal><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>Form1-&gt;Paste1-&gt;Enabled=false;</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">把子菜单项</SPAN><SPAN 
lang=EN-US>Paste</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>Copy</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时,系统的剪贴板就会带有数据,所以子菜单项</SPAN><SPAN 
lang=EN-US>Paste</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>Copy1Click()</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 lang=EN-US style="FONT-FAMILY: 'Times New Roman'">void 
__fastcall TForm1::Copy1Click(TObject *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 lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">Form1-&gt;Copy1-&gt;Enabled=true;<o:p></o:p></SPAN></P>
<P class=a0><SPAN lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">Form1-&gt;Paste1-&gt;Enabled=true;<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 lang=EN-US 
style="FONT-FAMILY: 'Times New Roman'">}<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=MsoNormal><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></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>Paste</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">菜单项显灰色,是无效的(如图</SPAN><SPAN 
lang=EN-US>3-26</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">);但是,单击</SPAN><SPAN 
lang=EN-US>Copy</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">菜单项后,</SPAN><SPAN 
lang=EN-US>Paste</SPAN><SPAN 
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">菜单项就有效了(如图</SPAN><SPAN 
lang=EN-US>3-27</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=214 
src="C++ Builder 程序设计实用教程 - 3_2_1 菜单及其概述 - 张晋 - 17xie.files/0639bb8fbf.jpg" 
width=293 v:shapes="_x0000_i1038"></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>3-26<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Paste</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=221 
src="C++ Builder 程序设计实用教程 - 3_2_1 菜单及其概述 - 张晋 - 17xie.files/785bb81ef2.jpg" 
width=302 v:shapes="_x0000_i1039"></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>3-27<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Paste</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 
lang=EN-US><o:p>&nbsp;</o:p></SPAN></P></DIV></DIV></CENTER>
<HR>
<SPAN id=theurl 
style="FONT-SIZE: 12px">本页地址:http://www.17xie.com/read.php?pid=5506</SPAN> 
</DIV>
<DIV id=read-title style="BORDER-TOP: white 1px solid">
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: right; PADDING-BOTTOM: 8px; PADDING-TOP: 8px">
<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=25'">上一页</SPAN> 
      <SPAN class=page-nor 
      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-here 
      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=27'">27</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=28'">28</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=29'">29</SPAN> 
      <SPAN class=page-nor 
      onclick="window.location.href='/read.php?bid=303&amp;seq=27'">下一页</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-mpage>
<DIV 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 8px; PADDING-TOP: 8px; TEXT-ALIGN: center">[关注本页] 
[在本页中加入书签] [收藏本书] [推荐本书] </DIV></DIV><!-- foot -->
<DIV id=xie_bottom><A class=xie1 href="http://www.17xie.com/help/help-wzjs.html" 
target=_blank>关于我们</A> <SPAN class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/index.html" target=_blank>帮助中心</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m6" target=_blank>版权声明</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m7" target=_blank>免责声明</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m8" target=_blank>联系我们</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/help/help-wzjs.html#m9" target=_blank>友情链接</A> <SPAN 
class=xiefont1>| </SPAN><A class=xie1 
href="http://www.17xie.com/bbs/show_bbs.php?fid=130"><FONT 
color=red>提交意见</FONT></A> <BR>Copyright <SPAN 
style="FONT-FAMILY: arial">©</SPAN> 2007 17xie.com 互联网协同写书平台<BR>
<SCRIPT language=javascript 
src="C++ Builder 程序设计实用教程 - 3_2_1 菜单及其概述 - 张晋 - 17xie.files/1261343.js" 
type=text/javascript></SCRIPT>
<NOSCRIPT><A href="http://www.51.la/?1261343" target=_blank><IMG 
style="BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BORDER-BOTTOM-STYLE: none" 
alt=我要啦免费统计 
src="C++ Builder 程序设计实用教程 - 3_2_1 菜单及其概述 - 张晋 - 17xie.files/go.htm"></A></NOSCRIPT> 
</DIV></DIV>
<SCRIPT>			setInterval("ajax_sr('/live.php','')",600000);			function chcolor(sz)			{				$('read-conts').style.backgroundColor = sz;			}						function clcp()			{				var rng = document.body.createTextRange();		        rng.moveToElementText(document.getElementById("theurl"));		        rng.execCommand("Copy");			}			document.body.onkeydown = clcp;			document.body.onmouseout = clcp;			document.body.onclick = clcp;					</SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

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