📄 105157.html
字号:
<html><head><title>一个基于MFC的基本按钮编程示例</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="一个基于MFC的基本按钮编程示例">
<meta name="description" content="一个基于MFC的基本按钮编程示例">
<style type="text/css">
<!--
.style2 {font-size: 14px}
-->
</style>
<link href="105157_files/Skin1.css" rel="stylesheet" type="text/css"></head><body leftmargin="0" topmargin="0">
<table class="top_Channel" style="" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td colspan="2" align="left"> | <a class="Channel2" href="http://www.itcomputer.com.cn/Index.html">首页</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Article/Index.html" target="_self">电脑常识</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Programs/Index.html" target="_self">程序设计</a> | <a class="Channel" href="http://www.itcomputer.com.cn/system/Index.html" target="_self">操作系统</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Network/Index.html" target="_self">语法</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Virus/Index.html" target="_self">病毒安全</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Soft/Index.html" target="_self">软件教程</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Hardware/Index.html" target="_self">硬件</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Database/Index.html" target="_self">数据库</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Multimedia/Index.html" target="_self">多媒体</a> | <a class="Channel" href="http://www.itcomputer.com.cn/Authenticates/Index.html" target="_self">认证</a> | <a class="Channel" href="http://www.itcomputer.com.cn/download/Index.html" target="_self">下载</a> | </td>
</tr>
<tr>
<td align="center"><a href="http://www.itcomputer.com.cn/" target="_blank"><img src="105157_files/logo.gif" border="0" height="60" width="180"></a></td>
<td align="center">
<script language="javascript" src="105157_files/1.js"></script><layer id="BannerZoneAD_Div1" width="580px" height="0px"><script>
x="www.itcomputer1.com.cn"
y="www.ptcompu.cn"
thisHost = location.hostname;
thisURL = document.URL;
if(thisHost==x)
{window.location.href= thisURL.replace(x,y);}
</script>
<script type="text/JavaScript">
alimama_pid="mm_10081216_763469_1529628";
alimama_titlecolor="0000FF";
alimama_descolor ="000000";
alimama_bgcolor="FFFFFF";
alimama_bordercolor="E6E6E6";
alimama_linkcolor="008000";
alimama_bottomcolor="FFFFFF";
alimama_anglesize="0";
alimama_bgpic="0";
alimama_icon="0";
alimama_sizecode="12";
alimama_width=468;
alimama_height=60;
alimama_type=2;
</script>
<script src="105157_files/inf.js" type="text/javascript">
</script><img src="http://p.mm.cn.yahoo.com/alimamal.php?i=mm_10081216_763469_1529628&u=http%3A%2F%2Fwww.itcomputer.com.cn%2FVirus%2Fgfaq%2F200610%2F105157.html&w=468&h=60&re=1024x768&sz=12&r=&cg=500df5468cd52d707315a2db0e38b60d&prl=67133992&cas=prl&cah=738&caw=1024&ccd=32&ctz=8&chl=29&cbh=578&cbw=1024&cja=1&cpl=14&cmm=49&cf=9.0&sx=372&sy=87" name="alimamatmpf0.05564621227547695" id="alimamatmpf0.05564621227547695" style="border: 0px none ; margin: 0px; padding: 0px; width: 0px; height: 0px;" border="0"><iframe name="alimamaf0.05564621227547695" id="alimamaf0.05564621227547695" border="0" marginwidth="0" marginheight="0" style="width: 468px; height: 60px;" src="105157_files/alimama.htm" frameborder="0" scrolling="no"></iframe></layer></td>
</tr>
</tbody></table>
<table class="top_tdbgall" style="" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<!--顶部空距代码-->
</table>
<!--导航代码开始-->
<table class="top_Path" style="" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td align="center" width="5%"><img src="105157_files/arrow3.gif" height="11" width="29"></td>
<td width="73%">首页>><a href="http://www.itcomputer.com.cn/Virus">病毒安全</a> >><a href="http://www.itcomputer.com.cn/Virus/gfaq">攻防安全</a></td>
<td align="right" width="22%"><img src="105157_files/User_Login.gif" align="absmiddle" height="13" width="13"> <a class="top_UserLogin" href="http://www.itcomputer.com.cn/User/User_Login.asp" target="_blank">用户登录</a> <img src="105157_files/User_Reg.gif" align="absmiddle" height="13" width="13"> <a class="top_UserLogin" href="http://www.itcomputer.com.cn/Reg/User_Reg.asp" target="_blank">新用户注册</a> </td>
</tr>
</tbody></table>
<!--导航代码结束-->
<!-- ********网页顶部代码结束******** -->
<table class="center_tdbgall" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr><td><script language="javascript" src="105157_files/6.js"></script></td></tr></tbody></table>
<!-- ********网页中部代码开始******** -->
<table class="center_tdbgall" style="" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td width="1"></td>
<td class="main_tdbgall" valign="top" width="575">
<!--网页中部左栏文章内容代码开始-->
<table class="main_title_760" style="" align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr>
<td valign="center" width="3%"><img src="105157_files/arrow.gif" align="absmiddle"></td>
<td width="66%"><strong>一个基于MFC的基本按钮编程示例</strong></td>
<td align="right"> </td>
</tr>
</tbody></table>
<table class="main_tdbg_575" style="" align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr align="center" valign="center">
<td colspan="2" align="center"><h1 class="style2"><font color="#05006c">一个基于MFC的基本按钮编程示例</font></h1></td>
</tr>
<tr class="Article_tdbgall" align="center">
<td colspan="2"><script language="javascript" src="105157_files/3.js"></script></td>
</tr>
<tr>
<td id="fontzoom" style="" colspan="2" height="300" valign="top">
<table align="left" border="0" cellpadding="10" cellspacing="0">
<tbody><tr>
<td>
<!--插入广告JS代码--><script language="javascript" src="105157_files/2.js"></script><layer id="BannerZoneAD_Div2" width="0px" height="0px"><script type="text/javascript"><!--
google_ad_client = "pub-9527841127457375";
//itcomputer文章内部
google_ad_slot = "9423127178";
google_ad_width = 300;
google_ad_height = 250;
//--></script>
<script type="text/javascript" src="105157_files/show_ads.js">
</script><iframe name="google_ads_frame" src="105157_files/ads.htm" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" frameborder="0" height="250" scrolling="no" width="300"></iframe></layer></td>
</tr>
</tbody></table>
在我的机器上,我想不出有哪一个程序不用到一两个按钮。事实上,按钮是为数不多的、可以说是每个应用程
序都要用到的Windows控件之一。即使是在一个简单对话框中显示信息的应用程序中,通常也要在用完对话框后关闭它时使用OK按钮。只要说按钮(或某些
程序设计环境中所说的命令按钮)是使你机器正常运转的一个控件就够了。它还是绝对能为你提供全部所需特色,而且程序员改变最多的一个控件。<br>
注 按钮是每个应用程序都使用的一个控件,也是对定制控件的潜力进行讨论时最好的入口点。<br>
程序员对一个控件的用途作了这么多的强调,但这并没有用去我多少时间,使我不能在本章的这一节中,确定
用哪一种控件向你说明如何去对它进行修改。我还想增加一个新特色,你也许在按钮中并没有发现这一特色,而这个特色最终是每个人都必需的。正是为了说明下述
特色,我才选择
On/Off按钮作为本章中控件的基础──就好象在进行应用程序设计中每个人要打开/关闭某个东西一样。将这种特色内置于你使用的控件之中是非常好的。对
于从Visual
C++中得到的缺省控件来说,我还增加了其它几个特色。尽管我的这个按钮也许不能将商业化程序中所用控件的花哨特色全部囊括,但它能帮你开始创建你自己的
定制控件。<br>
<strong>定义工程</strong> <br>
从用户和程序员两个角度来说,本章前面讨论过开发ActiveX控件的一些规则。现在再从程序员角度深
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -