亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch05.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>
	
	<TITLE>Teach Yourself Visual C++&#174; 5 in 24 Hours -- Hour 5 -- Button Controls</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<CENTER>
<H1><IMG SRC="sams.gif" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR>
<FONT COLOR="#000077">Teach Yourself Visual C++&#174; 5 in 24 Hours</FONT></H1>
</CENTER>
<CENTER>
<P><A HREF="ch04.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch04/ch04.htm"><IMG SRC="previous.gif" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="ch06.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch06/ch06.htm"><IMG
SRC="next.gif" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"
BORDER="0"></A><A HREF="index-1.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/index.htm"><IMG SRC="contents.gif" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/button/contents.gif" WIDTH="128"
HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> 
<HR>

</CENTER>
<CENTER>
<H1><FONT COLOR="#000077">- Hour 5 -<BR>
Button Controls</FONT></H1>
</CENTER>
<P>Button controls are probably the most flexible controls available in Windows.
Before learning about buttons, though, it's important to begin with a short lesson
about conditional expressions in C++ programs. In this hour you will also learn about

<UL>
	<LI>Using the different types of button controls provided by Windows<BR>
	<BR>
	
	<LI>Using the MFC <TT>CButton</TT> class that is used to manage button controls<BR>
	<BR>
	
	<LI>Using the MFC <TT>CWnd</TT> class to enable and disable controls
</UL>

<P>Later this hour, you will add each type of button to a dialog box-based project.
You will also use ClassWizard to add button events and member variables for the dialog
box's button controls.
<H2><FONT COLOR="#000077"><B>What Are Conditional Expressions?</B></FONT></H2>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>conditional expression</I>
is an expression that results in a <TT>true</TT> or <TT>false</TT> value.</P>
<P>Most programs exercise some type of control over their execution flow using conditional
expressions. They perform different actions based on varying conditions as the execution
progresses. Then, they repeat these actions until all their tasks are complete. For
example, a Windows program might need to search for a certain record from a database,
or might take different actions depending on the messages that are sent to it.</P>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>selection statement</I>
uses a conditional expression to pick a particular path of execution in your program.
This is similar to choosing a fork in the road.</P>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>sequence statement </I>uses
a conditional expression to determine how often to execute a part of your program.
<H3><FONT COLOR="#000077"><B>Selecting an Execution Path with Selection Statements</B></FONT></H3>
<P>The first set of control statements to look at are the selection statements. If
your program must take a particular action only if a certain condition is <TT>true</TT>,
or if a user must make a choice from a list of possible items, these statements are
for you.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>All selection statements
	work by evaluating an expression, then taking an action based on the value of that
	expression. 
<HR>


</BLOCKQUOTE>

<H4><FONT COLOR="#000077">Using the if Statement</FONT></H4>
<P>The <TT>if</TT> statement enables one or more statements to be executed only if
an expression inside the parentheses is <TT>true</TT>. If necessary, values inside
the parentheses are converted into Boolean values, with zero being converted to <TT>false</TT>
and all non-zero values converted to <TT>true</TT>.</P>
<P>Listing 5.1 provides a function that shows how the <TT>if</TT> statement is used.
If the parameter passed to the function is greater than zero, the function returns
a value of <TT>true</TT>.
<H4><FONT COLOR="#000077">TYPE: Listing 5.1. A function that returns true if a positive
number is passed to it.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>bool IsPositive( int nCheckValue )</TT>
<TT>{</TT>
<TT>    bool bReturn = false;</TT>

<TT>    if( nCheckValue &gt; 0 )</TT>
<TT>        bReturn = true;</TT>

<TT>    return bReturn;</TT>
</FONT></PRE>
<P><TT>}</TT>
<H4><FONT COLOR="#000077">Using Compound Statements</FONT></H4>
<P>The statement controlled by an <TT>if</TT> statement is executed only when the
test condition is <TT>true</TT>. If more than one statement must be executed, group
the statements together to form a compound statement. Compound statements are often
called <I>blocks</I> because they group statements into blocks of code.</P>
<P>A compound statement begins and ends with curly braces, just like a function body.
All the statements within a compound statement that follows an <TT>if</TT> statement
are executed when the test condition is <TT>true</TT>, as shown in Listing 5.2.
<H4><FONT COLOR="#000077">TYPE: Listing 5.2. Using a compound statement to group
several statements together.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void PrintTest(bool bShouldPrint)</TT>
<TT>{</TT>
<TT>    if( bShouldPrint == true )</TT>
<TT>    {</TT>
<TT>        cout &lt;&lt; &quot;A short demonstration of&quot; &lt;&lt; endl;</TT>
<TT>        cout &lt;&lt; &quot;a compound statement - also&quot; &lt;&lt; endl;</TT>
<TT>        cout &lt;&lt; &quot;known as a block.&quot; &lt;&lt; endl;</TT>
<TT>    }</TT>
</FONT></PRE>
<P><TT>}</TT> In Listing 5.2, the test for equality is made using <TT>==</TT>, the
equality operator.


<BLOCKQUOTE>
	<P>
<HR>
<FONT COLOR="#000077"><B>CAUTION:</B></FONT><B> </B>A common mistake is to use <TT>=</TT>,
	which is the assignment operator. 
<HR>


</BLOCKQUOTE>

<P>A standard code-formatting convention is to visually nest each conditional &quot;level&quot;
of your source code by indenting statements, as in Listings 5.1 and 5.2. Indentation
helps make your code more readable because it helps make the flow of control in your
source code easy to see.
<H4><FONT COLOR="#000077">Using else with if Statements</FONT></H4>
<P>You can couple an <TT>else</TT> statement with an <TT>if</TT> statement to create
an either/or selection. When the expression tested by the <TT>if</TT> statement is
<TT>true</TT>, the first statement (or block statement) is executed. When the expression
is <TT>false</TT>, the statements grouped with the <TT>else</TT> statement are executed
instead.</P>
<P>Listing 5.3 provides an example of a function that uses the <TT>if</TT> and <TT>else</TT>
statements. This function always returns the larger of two parameters passed to it.
<H4><FONT COLOR="#000077">TYPE: Listing 5.3. A function that uses the if and else
statements.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>int GetMax( int nFirst, int nLast )</TT>
<TT>{</TT>
<TT>    int nReturn;</TT>

<TT>    if( nFirst &gt; nLast )</TT>
<TT>        nReturn = nFirst;</TT>
<TT>    else</TT>
<TT>        nReturn = nLast;</TT>

<TT>    return nReturn;</TT>
</FONT></PRE>
<P><TT>}</TT>
<H4><FONT COLOR="#000077">Using the switch Statement</FONT></H4>
<P>Sometimes you must choose between more than just one or two alternatives. Suppose
you are implementing a simple menu function with three choices. If you use the <TT>if</TT>
statement, you might wind up with a function like the one shown in Listing 5.4.
<H4><FONT COLOR="#000077">TYPE: Listing 5.4. A menu-selection function.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>//</TT>
<TT>// Processes a selection from a character-based menu. If a</TT>
<TT>// valid selection is made, the proper functions are called,</TT>
<TT>// and true is returned. If an invalid selection is made,</TT>
<TT>// false is returned.</TT>
<TT>bool HandleMenuSelection( char chSelection )</TT>
<TT>{</TT>
<TT>    bool bValidSelection = true;</TT>

<TT>    if( chSelection == `F' )</TT>
<TT>        OpenNewFile();</TT>
<TT>    else if( chSelection == `P' )</TT>
<TT>        PrintDocument();</TT>
<TT>    else if( chSelection == `S' )</TT>
<TT>        SaveFile();</TT>
<TT>    else</TT>
<TT>        bValidSelection = false;</TT>

<TT>    return bValidSelection;</TT>
<TT>}</TT> </FONT></PRE>
<P>This is already starting to look a little cluttered, but how bad would it look
if you had a few more selections? What if you had 20 or 30? The solution is to use
the <TT>switch</TT> statement. A <TT>switch</TT> statement evaluates an expression
and then chooses from a list of choices, as shown in Listing 5.5.
<H4><FONT COLOR="#000077">TYPE: Listing 5.5. Using the switch statement.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>bool HandleMenuSelection( char chSelection )</TT>
<TT>{</TT>
<TT>    bool bValidSelection = true;</TT>

<TT>    switch( chSelection )</TT>
<TT>    {</TT>
<TT>        case `F':</TT>
<TT>            OpenNewFile();</TT>
<TT>            break;</TT>
<TT>        case `P':</TT>
<TT>            PrintDocument();</TT>
<TT>            break;</TT>
<TT>        case `S':</TT>
<TT>            SaveFile();</TT>
<TT>            break;</TT>

<TT>        default:</TT>
<TT>            bValidSelection = false;</TT>
<TT>    }</TT>
<TT>    return bValidSelection;</TT>
<TT>}</TT> </FONT></PRE>
<P>As Listing 5.5 shows, the <TT>switch</TT> statement has several different parts.
Here are the major features of a <TT>switch</TT> statement:

<UL>
	<LI>The <TT>switch()</TT> expression. The expression contained inside the <TT>switch</TT>
	parentheses is evaluated, and its value is used as the basis for making the selection.<BR>
	<BR>
	
	<LI>One or more <TT>case</TT> labels. Each <TT>case</TT> label includes a value.
	Every <TT>case</TT> label must be unique. If a <TT>case</TT> label's value matches
	the <TT>switch</TT> expression, the statements after the <TT>case</TT> label are
	executed.<BR>
	<BR>
	
	<LI>One or more <TT>break</TT> statements. The <TT>break</TT> statement is used to
	stop execution inside a <TT>switch</TT> statement. A <TT>break</TT> statement is
	normally placed between every <TT>case</TT>. If a <TT>break</TT> statement is removed,
	statements in the next <TT>case</TT> are executed until a <TT>break</TT> is reached,
	or until no more statements remain inside the <TT>switch</TT>.<BR>
	<BR>
	
	<LI>A default label. The default label is selected when no <TT>case</TT> labels match
	the <TT>switch</TT> expression.
</UL>

<H2><FONT COLOR="#000077"><B>What Is a Button?</B></FONT></H2>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>button</I> is a special
type of window that contains a text or bitmap label, usually found in a dialog box,
toolbar, or other window containing controls.</P>
<P>Five different types of buttons are provided by Windows:

<UL>
	<LI><I>Pushbuttons</I> have a raised, three-dimensional appearance and seem to be
	depressed as they are clicked with the mouse. Pushbuttons normally have a text label
	on the face of the control.<BR>
	<BR>
	
	<LI><I>Radio buttons</I> consist of a round button with a label adjacent to it.<BR>
	<BR>
	
	<LI><I>Check boxes</I> are made up of a square box that contains a check mark when
	selected and a label next to the control.<BR>
	<BR>
	
	<LI><I>Owner-drawn</I> buttons are painted by the button's owner instead of by Windows.<BR>
	<BR>
	
	<LI><I>Group boxes</I> are simply rectangles that are used to surround other controls
	that have a common purpose.
</UL>

<P>In general, buttons are used to indicate a user selection. Buttons are used in
Windows programs because they are convenient and easy for users to operate. Users
have come to expect buttons to be presented in a large number of cases, especially
when dialog boxes are present in a program.
<H3><FONT COLOR="#000077"><B>What Are Pushbuttons?</B></FONT></H3>
<P>Almost every dialog box has at least one pushbutton control to indicate actions
that a user can invoke. Some common uses for pushbuttons include closing a dialog
box, beginning a search, or asking for help.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久影院电视剧免费观看| 欧美人妇做爰xxxⅹ性高电影| 久久人人爽人人爽| 国产乱人伦偷精品视频不卡| 国产亚洲精品bt天堂精选| 国产精品影音先锋| 国产精品久久久久久久久免费相片| 成人av资源站| 亚洲国产欧美在线人成| 欧美日韩精品三区| 精品亚洲欧美一区| 成人免费一区二区三区视频 | 国产精品久久久久久久第一福利 | 欧美精品一区二区三区一线天视频| 青青草精品视频| 26uuu国产日韩综合| 波多野洁衣一区| 亚洲444eee在线观看| 精品电影一区二区| 色婷婷香蕉在线一区二区| 视频一区视频二区中文| 国产清纯美女被跳蛋高潮一区二区久久w | 亚洲国产一区二区三区青草影视| 日韩一区和二区| 99久久99精品久久久久久| 亚洲成人高清在线| 国产视频一区二区在线| 欧洲一区二区三区免费视频| 麻豆国产一区二区| 亚洲色图20p| 精品久久一区二区| 91浏览器打开| 国产一区二区三区视频在线播放| 亚洲人成人一区二区在线观看 | 91小视频在线免费看| 日韩影院精彩在线| 国产精品久久久久久久久搜平片| 91麻豆精品国产91久久久更新时间| 国产成人福利片| 视频一区中文字幕国产| 国产精品久久久久影院老司| 欧美一区二区在线视频| 91亚洲精品久久久蜜桃网站 | 日韩中文字幕av电影| 国产精品麻豆网站| 精品国产乱码久久久久久夜甘婷婷 | 日本一区二区三区高清不卡| 欧美久久久久中文字幕| 欧美va亚洲va在线观看蝴蝶网| 北岛玲一区二区三区四区| 久久黄色级2电影| 亚洲国产视频直播| 成人欧美一区二区三区小说 | 91麻豆国产福利在线观看| 国产麻豆精品久久一二三| 免费久久99精品国产| 一区二区国产盗摄色噜噜| 国产精品蜜臀av| 久久综合久久鬼色| 精品国产乱码久久久久久蜜臀| 欧美日韩一区二区三区四区| 97se亚洲国产综合自在线不卡| 国产精品一级在线| 国产精品一区二区不卡| 精品伊人久久久久7777人| 日本不卡一区二区三区高清视频| 亚洲精品久久嫩草网站秘色| 日韩理论片中文av| 最新热久久免费视频| 国产精品嫩草99a| 国产精品色在线观看| 国产片一区二区三区| 国产欧美一区视频| 国产精品亲子乱子伦xxxx裸| 欧美韩国日本不卡| 国产精品成人免费精品自在线观看| 国产香蕉久久精品综合网| 精品美女一区二区| 久久免费精品国产久精品久久久久| 欧美电影免费观看高清完整版在线| 日韩欧美国产三级| 2024国产精品| 国产欧美精品区一区二区三区 | 91精品国产综合久久精品性色| 欧美视频一区在线| 91精品国产91热久久久做人人| 日韩欧美资源站| 久久精品视频在线免费观看| 欧美韩国日本一区| 一区二区视频免费在线观看| 亚洲愉拍自拍另类高清精品| 亚洲超丰满肉感bbw| 麻豆一区二区在线| 国产乱码字幕精品高清av| 日韩午夜三级在线| 26uuu另类欧美亚洲曰本| 亚洲国产精品av| 一区二区三区四区av| 亚洲一级二级在线| 激情综合网最新| 北岛玲一区二区三区四区| 欧美三级韩国三级日本一级| 欧美大片国产精品| 中文字幕一区二区三区av| 亚洲成人自拍偷拍| 国产一区 二区| 91国偷自产一区二区使用方法| 7777精品久久久大香线蕉| 精品国产乱码久久久久久夜甘婷婷 | 国产精品色一区二区三区| 一区二区三区久久久| 美女一区二区在线观看| 国产91精品久久久久久久网曝门| 一本大道av一区二区在线播放| 欧美二区在线观看| 中文字幕欧美区| 日韩高清欧美激情| 成人av网址在线观看| 在线不卡中文字幕播放| 亚洲国产精华液网站w| 日韩va欧美va亚洲va久久| 成人免费福利片| 日韩一级成人av| 18涩涩午夜精品.www| 久久精品久久精品| 在线免费观看日韩欧美| 国产欧美日本一区二区三区| 亚洲成人av一区二区三区| 成人妖精视频yjsp地址| 91精品国产91久久久久久最新毛片 | 2024国产精品视频| 午夜精品成人在线视频| 99久久亚洲一区二区三区青草 | 一本久道中文字幕精品亚洲嫩| 日韩欧美黄色影院| 性久久久久久久| 不卡的电影网站| 久久久国产一区二区三区四区小说 | www日韩大片| 水野朝阳av一区二区三区| 色综合久久久久久久久| 久久先锋影音av鲁色资源| 偷拍日韩校园综合在线| 一本高清dvd不卡在线观看| 欧美激情中文字幕一区二区| 精品一区二区在线看| 91麻豆精品国产91久久久久| 一区二区三区加勒比av| 色综合天天综合狠狠| 国产精品免费观看视频| 国产黄色精品视频| 欧美精品一区二区在线观看| 蜜桃视频一区二区三区| 欧美精品在线一区二区三区| 亚洲国产精品久久不卡毛片| 91麻豆高清视频| 一区二区三区高清| 欧美性做爰猛烈叫床潮| 一区二区三区高清在线| 一本一本大道香蕉久在线精品| **网站欧美大片在线观看| av中文字幕一区| 中文字幕一区二区三区色视频| gogogo免费视频观看亚洲一| 国产精品久久久久婷婷二区次| 大胆亚洲人体视频| 亚洲视频网在线直播| 91免费看视频| 一区二区三区免费观看| 欧美三级日韩三级国产三级| 亚洲成人在线网站| 欧美一区二区三区在线视频| 美女精品一区二区| 久久综合九色综合97_久久久| 国产精品一二一区| 综合自拍亚洲综合图不卡区| 99久久伊人精品| 亚洲图片欧美色图| 91精品国产综合久久久蜜臀粉嫩 | 欧美视频中文一区二区三区在线观看| 一区二区在线看| 欧美日韩国产成人在线91| 日韩国产欧美在线播放| 精品欧美黑人一区二区三区| 国产毛片精品视频| ...xxx性欧美| 欧美日韩国产一区二区三区地区| 美女视频黄 久久| 国产视频一区二区三区在线观看| 成+人+亚洲+综合天堂| 夜夜操天天操亚洲| 亚洲午夜免费电影| 欧美电视剧在线看免费| 成人app在线| 亚洲国产视频一区二区| 2023国产精华国产精品| 色欧美日韩亚洲| 人人狠狠综合久久亚洲| 国产精品欧美一区二区三区| 欧美日韩一二三区|