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

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

?? ch05.htm

?? 英文VC快速教程,手把手教學(xué),真的24節(jié)課程可以完全自學(xué)VC,達(dá)到入門級水平
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
dialog box is displayed, nothing happens when the buttons are used because no button
events are handled by the dialog box class.</P>
<P>Pushbuttons are normally associated with button events in a dialog box class.
To add a button event for <TT>IDC_BTN_TEST</TT>, follow these steps:

<DL>
	<DD>1. Open ClassWizard.<BR>
	<BR>
	2. Select the tab labeled Message Maps.<BR>
	<BR>
	3. Select <TT>CButtonDlg</TT> as the class name.<BR>
	<BR>
	4. Select <TT>IDC_BTN_TEST</TT> as the object ID.<BR>
	<BR>
	5. Select <TT>BN_CLICKED</TT> from the Messages list box.<BR>
	<BR>
	6. Press the button labeled Add Function and accept the default name for the member
	function.<BR>
	<BR>
	7. Close ClassWizard.
</DL>

<P>Check boxes and radio buttons sometimes use <TT>BN_CLICKED</TT> messages, but
not as often as pushbuttons. Add the source code from Listing 5.6 to the <TT>CButtonDlg::OnBtnTest</TT>
function, then compile and run the project.
<H4><FONT COLOR="#000077">TYPE: Listing 5.6. The CButtonDlg::OnBtnTest member function.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CButtonDlg::OnBtnTest()</TT>
<TT>{</TT>
<TT>    AfxMessageBox( &quot;Test button pressed&quot; );</TT>

<TT>}</TT></FONT></PRE>
<H3><FONT COLOR="#000077"><B>Changing a Button's Label</B></FONT></H3>
<P>Like all controls, a button is a just a special type of window. For that reason,
the MFC class library uses the <TT>CWnd</TT> class as a base class for all control
classes. To change the label for a button, you can use the <TT>SetWindowText</TT>
function.</P>
<P>This function commonly is used to change the label for buttons after the dialog
box has been created. You can use the <TT>SetWindowText</TT> function to change the
Amplify button from the earlier example into a Record button. To do so, replace the
<TT>CButtonDlg::OnBtnTest</TT> function with the function provided in Listing 5.7.
<H4><FONT COLOR="#000077">TYPE: Listing 5.7. Changing the label for several buttons.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CButtonDlg::OnBtnTest()</TT>
<TT>{</TT>
<TT>    static BOOL bSetWaterLevel = TRUE;</TT>
<TT>    if( bSetWaterLevel == TRUE )</TT>
<TT>    {</TT>
<TT>        m_btnVolume.SetWindowText( &quot;&amp;Water Level&quot; );</TT>
<TT>        m_btnAmp.SetWindowText( &quot;&amp;Record&quot; );</TT>
<TT>        bSetWaterLevel = FALSE;</TT>
<TT>    }</TT>
<TT>    else</TT>
<TT>    {</TT>
<TT>        m_btnVolume.SetWindowText( &quot;&amp;Volume&quot; );</TT>
<TT>        m_btnAmp.SetWindowText( &quot;&amp;Amplify&quot; );</TT>
<TT>        bSetWaterLevel = TRUE;</TT>
<TT>    }</TT>
</FONT></PRE>
<PRE><FONT COLOR="#0066FF"><TT>}</TT> </FONT></PRE>
<P>After you build the Button example using the code from Listing 5.7, the radio
button group will alternate between Volume and Water Level.
<H3><FONT COLOR="#000077"><B>Enabling and Disabling Buttons</B></FONT></H3>
<P>Most controls are enabled by default, although a control can be initially disabled
by setting that attribute in its property list. A control can be selected only if
it is enabled. The <TT>CWnd</TT> class includes the <TT>EnableWindow</TT> member
function that allows a <TT>CWnd</TT> object to be enabled or disabled. Because <TT>CButton</TT>
and all other control classes are derived from <TT>CWnd</TT>, they include all the
member data and member functions from the <TT>CWnd</TT> class, and you can disable
a button like this:</P>
<PRE><FONT COLOR="#0066FF"><TT>pButton-&gt;EnableWindow( FALSE );  // Disables control</TT>
</FONT></PRE>
<P>The parameter for <TT>EnableWindow</TT> is <TT>TRUE</TT> if the window or control
should be enabled, and <TT>FALSE</TT> if it should be disabled. The default parameter
for <TT>EnableWindow</TT> sets the parameter to <TT>TRUE</TT> because no parameter
is needed to enable the control:</P>
<PRE><FONT COLOR="#0066FF"><TT>pButton-&gt;EnableWindow();  // Enables control</TT>
</FONT></PRE>
<P>It is common practice for buttons and other controls to be enabled or disabled
based on events that are received by the dialog box. As an example, pressing one
button can cause another button to be disabled or enabled. To disable a dialog box
control, replace the <TT>CButtonDlg::OnBtnTest</TT> function with the source code
provided in Listing 5.8.
<H4><FONT COLOR="#000077">TYPE: Listing 5.8. Using CWnd::EnableWindow to disable
a dialog box control.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CButtonDlg::OnBtnTest()</TT>
<TT>{</TT>
<TT>    static BOOL bEnableControl = FALSE;</TT>

<TT>     m_btnAmp.EnableWindow( bEnableControl );</TT>

<TT>    if( bEnableControl == TRUE )</TT>
<TT>        bEnableControl = FALSE;</TT>
<TT>    else</TT>
<TT>        bEnableControl = TRUE;</TT>
<TT>}</TT> </FONT></PRE>
<P>Now when you click the Test button, the Amplify check box is disabled. When you
click the Test button again, the check box is enabled.
<H3><FONT COLOR="#000077"><B>Hiding a Button</B></FONT></H3>
<P>It's not unusual to need to hide a button that is located in a dialog box. Often,
a button has its properties set to be hidden by default. Once again, the <TT>CWnd</TT>
class has a member function that can be used to hide or display a window as needed.
Use the <TT>CWnd::ShowWindow</TT> member function like this:</P>
<PRE><FONT COLOR="#0066FF"><TT>pButton-&gt;ShowWindow( SW_HIDE );  // Hide control</TT>
</FONT></PRE>
<P>This code hides the <TT>pButton</TT> window, which is a button control in this
case. To display a hidden window, the <TT>ShowWindow</TT> function is used with the
<TT>SW_SHOW</TT> parameter:</P>
<PRE><FONT COLOR="#0066FF"><TT>pButton-&gt;ShowWindow( SW_SHOW );  // Display control</TT>
</FONT></PRE>
<P>Listing 5.9 provides a function that uses <TT>CWnd::ShowWindow</TT> to alternately
hide and display some of the other buttons in the main dialog box.
<H4><FONT COLOR="#000077">TYPE: Listing 5.9. Using CWnd::ShowWindow to hide a dialog
box control.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CButtonDlg::OnBtnTest()</TT>
<TT>{</TT>
<TT>    static int nShowControl = SW_HIDE;</TT>

<TT>    m_btnAmp.ShowWindow( nShowControl );</TT>

<TT>    if( nShowControl == SW_SHOW )</TT>
<TT>        nShowControl = SW_HIDE;</TT>
<TT>    else</TT>
<TT>        nShowControl = SW_SHOW;</TT>
</FONT></PRE>
<PRE><FONT COLOR="#0066FF"><TT>}</TT></FONT></PRE>
<H2><FONT COLOR="#000077"><B>Defining and Setting Tab Order</B></FONT></H2>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>When a dialog box is presented
to the user, one control will have the <I>keyboard focus</I>, sometimes just called
the <I>focus</I>. The control that has the focus receives all input from the keyboard.
When a control has the focus, it has a dotted focus rectangle drawn around it.</P>
<P>A user can change the focus to a new control by pressing the Tab key on the keyboard.
Each time the Tab key is pressed, a new control receives the focus. If you aren't
familiar with how this works, you might want to experiment with a few dialog boxes
from Developer Studio.</P>
<P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>The controls are always selected
in a fixed order, known as the <I>tab order</I>. Tab order lets users select controls
without using the mouse. Although almost all Windows users have access to a mouse,
using the keyboard sometimes is more convenient. Also, because tabbing between controls
is a standard feature in Windows dialog boxes, you should use it correctly.


<BLOCKQUOTE>
	<P>
<HR>
<B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>The tab order should
	follow a logical pattern through the dialog box. If the tab order follows a predictable
	pattern, users of the dialog box will find it much easier to navigate using the Tab
	key. Usually, the first editable control receives the focus when the dialog box is
	opened. After that, the focus should be passed to the next logical control in the
	dialog box. The buttons that control the dialog box--OK, Cancel, and Apply--should
	receive the focus last. 
<HR>


</BLOCKQUOTE>

<P>In a dialog box, the tab order follows the sequence in which controls were defined
in the resource script. As new controls are added, they are placed at the end of
the tab order. You can use the resource tools included in the Developer Studio to
change this sequence, thereby altering the tab order.


<BLOCKQUOTE>
	<P>
<HR>
<B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>To prevent a user
	from selecting a control using the Tab key, clear the Tab Stop property for the control.
	
<HR>


</BLOCKQUOTE>

<P>With the dialog box displayed in the Developer Studio, select Tab Order from the
Layout menu, or press Ctrl+D. Each control in the dialog box that has the <TT>tabstop</TT>
attribute is tagged with a number, as shown in Figure 5.3.</P>
<P><A NAME="03"></A><A HREF="03.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch05/03.htm"><B>Figure 5.3.</B> </A><I><BR>
Displaying the tab order for dialog box controls.</I></P>
<P>To change the tab order, just click the control that should be in tab position
1; the tag associated with that control changes to reflect its new tab order. Repeat
the process of clicking controls until the displayed tab order is correct.
<H2><FONT COLOR="#000077"><B>Summary</B></FONT></H2>
<P>In this hour you learned about the different types of button controls provided
by Windows and used the controls in a variety of ways. You also built a dialog box-based
project. Finally, you learned about control tab order and conditional expressions.
<H2><FONT COLOR="#000077"><B>Q&amp;A</B></FONT></H2>

<DL>
	<DD><B>Q What is the difference between <TT>BOOL</TT> and <TT>bool</TT>?</B><BR>
	<BR>
	<B>A</B> The <TT>bool</TT> type is defined by the C++ standard, whereas the <TT>BOOL</TT>
	type is defined deep inside the Windows header files. In practice, they work very
	much alike, and you can interchange them without any problem. The reason for the
	<TT>BOOL</TT> type is historical; <TT>bool</TT> was only recently added to the C++
	standard, and the <TT>BOOL</TT> type has been used for Windows programming for many
	years. In fact, <TT>BOOL</TT> was used for Windows programming before C++ was invented.<BR>
	<BR>
	<B>Q When is it more appropriate to hide a control instead of disabling it?</B><BR>
	<BR>
	<B>A</B> If a control is unavailable or doesn't make sense for a temporary period,
	it should be disabled. If the control is unavailable for a long period of time, it
	should be hidden. In general, the user should be presented with as few options as
	possible, especially if those options cannot be selected.
</DL>

<H2><FONT COLOR="#000077"><B>Workshop</B></FONT></H2>
<P>The Workshop is designed to help you anticipate possible questions, review what
you've learned, and begin thinking ahead to putting your knowledge into practice.
The answers to the quiz are in Appendix B, &quot;Quiz Answers.&quot;
<H3><FONT COLOR="#000077"><B>Quiz</B></FONT></H3>

<DL>
	<DD>1. What is the difference between the Cancel and Close buttons?<BR>
	<BR>
	2. What is the difference between the OK and Apply buttons?<BR>
	<BR>
	3. What MFC class is used to manage button controls?<BR>
	<BR>
	4. What are the five types of button controls?<BR>
	<BR>
	5. How do you prevent the Tab key from being used to select a control?<BR>
	<BR>
	6. What function is used to disable a control at runtime?<BR>
	<BR>
	7. What function is used to hide a control at runtime?<BR>
	<BR>
	8. What is the <TT>default</TT> label used for in a <TT>switch</TT> statement?<BR>
	<BR>
	9. What is the difference between the <TT>=</TT> and <TT>==</TT> operators?<BR>
	<BR>
	10. What function is used to change the label on a button?
</DL>

<H3><FONT COLOR="#000077"><B>Exercises</B></FONT></H3>

<DL>
	<DD>1. Modify the Button project so that the Amplify check box is removed from the
	tab order.<BR>
	<BR>
	2. Modify the Button project so that the source code from Listing 5.7 is used, except
	that the Amplify check box is hidden when the group box caption is set to Water Level.
</DL>

<CENTER>
<P>
<HR>
<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> <BR>
<BR>
<BR>
<IMG SRC="corp.gif" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/button/corp.gif" WIDTH="284" HEIGHT="45" ALIGN="BOTTOM" ALT="Macmillan Computer Publishing USA"
BORDER="0"></P>

<P>&#169; <A HREF="copy.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
夜夜精品视频一区二区| 免费观看一级欧美片| 中文字幕免费一区| 国产女人18毛片水真多成人如厕| 久久午夜免费电影| 欧美精品一区二区不卡| 久久丝袜美腿综合| 日本一区二区三区四区在线视频| 久久久精品中文字幕麻豆发布| 国产亚洲一本大道中文在线| 日本一区二区成人| 中文字幕一区二区三区不卡 | 亚洲午夜免费福利视频| 亚洲综合在线观看视频| 亚洲国产日韩a在线播放性色| 亚洲综合色成人| 天天av天天翘天天综合网| 成人免费看片app下载| 99精品视频中文字幕| 色综合久久久久久久| 在线精品视频免费观看| 欧美日韩电影一区| 26uuu亚洲综合色欧美 | 午夜不卡av在线| 久久精品国产一区二区三区免费看 | 久久精品人人做| 国产精品网站在线播放| 亚洲人成亚洲人成在线观看图片| 一区二区三区高清在线| 视频一区中文字幕国产| 国产一区二区三区观看| 色哟哟一区二区| 欧美一二三四区在线| 国产日韩一级二级三级| 一级中文字幕一区二区| 蜜桃av一区二区| 99热国产精品| 91精品国产乱码久久蜜臀| 久久久久综合网| 亚洲无人区一区| 国产精品一区二区在线观看不卡 | 极品美女销魂一区二区三区免费 | 国产精品久久毛片a| 亚洲欧美另类久久久精品| 日韩av中文字幕一区二区| 粉嫩在线一区二区三区视频| 在线免费观看不卡av| 欧美xingq一区二区| 1区2区3区欧美| 日本不卡123| 99视频一区二区| 日韩午夜中文字幕| 亚洲靠逼com| 狠狠色丁香久久婷婷综合_中| 91啪在线观看| 久久久久综合网| 午夜视频久久久久久| 丁香婷婷综合色啪| 欧美一区二区视频在线观看2020| 国产精品青草综合久久久久99| 日韩国产欧美在线播放| 99久久99久久精品免费观看| 精品噜噜噜噜久久久久久久久试看| 亚洲欧洲日韩av| 韩日欧美一区二区三区| 欧美日韩综合不卡| 中文字幕一区日韩精品欧美| 久久99热国产| 欧美日韩色综合| 亚洲欧美色一区| 国产高清视频一区| 欧美日韩亚洲另类| 国产成都精品91一区二区三| 色中色一区二区| 日韩精品中文字幕在线不卡尤物 | 亚洲同性gay激情无套| 久久精品国产免费| 91福利在线看| 国产精品色在线观看| 精品亚洲国内自在自线福利| 91精品久久久久久久久99蜜臂| 亚洲午夜国产一区99re久久| 99re8在线精品视频免费播放| 久久综合久色欧美综合狠狠| 蜜臀av一区二区在线免费观看 | 亚洲欧美国产77777| 国产成人精品亚洲日本在线桃色| 日韩视频一区二区在线观看| 亚洲大型综合色站| 91福利在线看| 一区二区不卡在线播放| 色哟哟精品一区| 亚洲欧洲av一区二区三区久久| 国产ts人妖一区二区| 久久这里都是精品| 国产在线一区二区综合免费视频| 欧美电影免费观看完整版| 美日韩一区二区三区| 91麻豆精品国产91久久久使用方法| 亚洲.国产.中文慕字在线| 欧日韩精品视频| 亚洲综合免费观看高清完整版在线 | 一区二区三区中文字幕| 92精品国产成人观看免费| 日韩毛片一二三区| 国产欧美一区二区精品性色| 高清成人在线观看| 亚洲国产乱码最新视频| 五月天网站亚洲| 成人高清免费观看| 久久99国产乱子伦精品免费| 日韩欧美一级片| 国产在线视视频有精品| 国产欧美精品国产国产专区| aaa亚洲精品| 亚洲精品大片www| 欧美另类高清zo欧美| 日韩av在线免费观看不卡| 日韩写真欧美这视频| 国产一区二区美女诱惑| 中文字幕免费一区| 色天天综合色天天久久| 午夜av电影一区| 精品国产乱码久久久久久老虎| 国产.欧美.日韩| 亚洲精品久久久蜜桃| 91精品在线一区二区| 国产一区二区三区久久久 | 亚洲成a人v欧美综合天堂下载| 7777女厕盗摄久久久| 狠狠色伊人亚洲综合成人| 中文字幕精品三区| 91蜜桃婷婷狠狠久久综合9色| 亚洲国产日韩精品| 精品奇米国产一区二区三区| 成人av在线播放网站| 亚洲成av人在线观看| 2021国产精品久久精品| 91丨porny丨最新| 肉肉av福利一精品导航| 久久久久久亚洲综合| 色菇凉天天综合网| 免费成人av在线播放| 中文字幕精品三区| 欧美夫妻性生活| 国产高清精品在线| 亚洲国产精品一区二区www| 久久久久久久久久久久电影| 色狠狠一区二区三区香蕉| 久久电影网站中文字幕| 综合久久国产九一剧情麻豆| 日韩欧美亚洲一区二区| 99久久精品国产导航| 日韩精品一级二级| 亚洲欧洲成人精品av97| 日韩一级片在线播放| 91丨九色丨蝌蚪富婆spa| 久久精品999| 亚洲精品成人少妇| 久久免费看少妇高潮| 欧美日韩色一区| 91麻豆精品在线观看| 久久99精品国产麻豆不卡| 亚洲精品老司机| 亚洲国产高清在线观看视频| 91精品麻豆日日躁夜夜躁| 91香蕉视频黄| 国产乱淫av一区二区三区 | 欧美日韩精品是欧美日韩精品| 国产**成人网毛片九色 | 欧美日韩美少妇| 成人高清视频在线| 精品一区二区三区欧美| 亚洲一区二区免费视频| 国产精品久久久久久亚洲毛片| 精品国产乱码久久久久久闺蜜| 欧美婷婷六月丁香综合色| av一区二区三区四区| 国产一区 二区| 日韩综合小视频| 亚洲一区二区三区精品在线| 综合激情成人伊人| 国产色产综合色产在线视频| 日韩三级伦理片妻子的秘密按摩| 欧美色涩在线第一页| 91视频精品在这里| 不卡的av电影| 成人av网站大全| 丁香婷婷综合五月| 国产一区三区三区| 蜜臀av一区二区在线观看| 日韩精品一级中文字幕精品视频免费观看 | 欧美伊人精品成人久久综合97 | 中文字幕一区二区日韩精品绯色| 久久亚洲综合色| 精品理论电影在线| 精品国产青草久久久久福利| 91精品国产91综合久久蜜臀| 欧美日韩一区二区电影| 欧美无乱码久久久免费午夜一区 |