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

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

?? ch07.htm

?? 24小時學(xué)會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 7 -- Using List Box and Combo Box Controls</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER><H1><IMG SRC="../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="../ch06/ch06.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch08/ch08.htm"><IMGSRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><CENTER><H1><FONT COLOR="#000077">- Hour 7 -<BR>Using List Box and Combo Box Controls</FONT></H1></CENTER><P>List boxes and combo boxes are two types of controls that are used often in Windowsprogramming. The list box often is used to enable a user to select from a large numberof possible choices, whereas the combo box is a combination of the list box and editcontrols. In this hour, you will learn about these controls and use them in simpleexamples.<H2><FONT COLOR="#000077"><B>Using Loops</B></FONT></H2><P>In Hour 5, &quot;Button Controls,&quot; you learned about using conditional expressionsto control the flow of execution in C++ programs. Another way to control the flowof execution in your program is to execute sequences, also known as loops or iterations.Popular uses for loops include waiting for user input, printing a certain numberof reports, or reading input from a file until an End Of File (EOF) mark is detected.Three different loop statements are used in C++:<UL>	<LI>The <TT>while</TT> loop	<LI>The <TT>do-while</TT> loop	<LI>The <TT>for</TT> loop</UL><H3><FONT COLOR="#000077"><B>Using the <TT>while</TT> Loop</B></FONT></H3><P>The <TT>while</TT> loop is used to execute a statement as long as a test expressionevaluates as <TT>true</TT>. Listing 7.1 shows an example of a <TT>while</TT> loop.<H4><FONT COLOR="#000077">TYPE: Listing 7.1. Executing a while loop 10 times.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>CString szMsg;</TT><TT>szMsg.Format(&quot;This is loop number %d&quot;, nLoopCounter);</TT><TT>int nLoopCounter = 0;</TT><TT>while(nLoopCounter &lt; 10)</TT><TT>{</TT><TT>    nLoopCounter++;</TT><TT>    AfxMessageBox(szMsg);</TT><TT>}</TT><TT>AfxMessageBox(&quot;The loop is finished&quot;);</TT></FONT></PRE><P>In Listing 7.1, the compound statement following the <TT>while</TT> loop is executedas long as <TT>nLoopCounter</TT> is less than 10. When <TT>nLoopCounter</TT> is equalto 10, the condition tested by <TT>while</TT> becomes <TT>false</TT>, and the nextstatement following the block controlled by <TT>while</TT> is executed. In this example,a compound statement is executed; however, a single statement can also be executed.</P><P>Compound statements were discussed in Hour 5. A compound statement is a groupof statements that are enclosed within curly braces.<H3><FONT COLOR="#000077"><B>Using a <TT>do-while</TT> Loop</B></FONT></H3><P>A relative of the <TT>while</TT> loop is the <TT>do-while</TT> loop. The <TT>do-while</TT>loop is used when a statement or series of statements must be executed at least once.Listing 7.2 is an example of a <TT>do-while</TT> loop used to check an input characterfor <TT>Q</TT>.<H4><FONT COLOR="#000077">TYPE: Listing 7.2. Using the do-while loop to test foruser input in a console mode program.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>#include &lt;iostream&gt;</TT><TT>using namespace std;</TT><TT>int main()</TT><TT>{</TT><TT>    char ch;</TT><TT>    do{</TT><TT>        cout &lt;&lt; &quot;\nPress `Q' to exit -&gt;&quot;;</TT><TT>        cin &gt;&gt; ch;</TT><TT>        // Ignore input until a carriage return.</TT><TT>        cin.ignore( 120, `\n');</TT><TT>    }while( ch != `Q' );</TT><TT>    cout &lt;&lt; &quot;Goodbye&quot; &lt;&lt; endl;</TT><TT>    return 0;</TT><TT>}</TT></FONT></PRE><H3><FONT COLOR="#000077"><B>Using the <TT>for</TT> Loop</B></FONT></H3><P>The <TT>for</TT> loop is often used in C++ programs to write a very compact loopstatement. The <TT>for</TT> loop enables you to write loops in a more compact stylethan is possible using <TT>while</TT> loops. Listing 7.3 is equivalent to Listing7.1, except that it has been rewritten using the <TT>for</TT> loop.<H4><FONT COLOR="#000077">TYPE: Listing 7.3. Using a for loop to display a message10 times.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>CString szMsg;</TT><TT>szMsg.Format(&quot;This is loop number %d&quot;, nLoopCounter);</TT><TT>for(int nLoopCounter = 0; nLoopCounter &lt; 10; nLoopCounter++)</TT><TT>{</TT><TT>    AfxMessageBox(szMsg);</TT><TT>}</TT><TT>AfxMessageBox(&quot;The loop is finished&quot;);</TT></FONT></PRE><P>There are four components to every <TT>for</TT> statement:</P><PRE><FONT COLOR="#0066FF"><TT>for( <I>expression1</I>; <I>expression2</I>; <I>expression3</I> )</TT><TT>    <I>statement1</I></TT></FONT></PRE><P>When the <TT>for</TT> loop begins, <I><TT>expression1</TT></I> is executed. Thisis usually where you declare loop counters. As long as <I><TT>expression2</TT></I>is true, the statement controlled by the loop is executed. After the controlled statement(<I><TT>statement1</TT></I>) has been performed, <I><TT>expression3</TT></I> is executed.Loop counters are usually incremented in <I><TT>expression3</TT></I>.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>In the example	provided in Listing 7.3, the expression <TT>nLoopCounter++</TT> was used as a way	to increment the value of <TT>nLoopCounter</TT> by one. To decrement the value, you	can use <TT>nLoopCounter--</TT>. <HR></P>	<P><HR><B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>As a rule of thumb,	if the loop is executed a fixed number of times, it's usually easier to use <TT>for</TT>	instead of <TT>while</TT>. However, if you are waiting for an event to occur, or	if the number of loops isn't easily predicted, it's better to use <TT>while</TT>.	<HR></BLOCKQUOTE><H2><FONT COLOR="#000077"><B>What Are List Boxes?</B></FONT></H2><P><FONT COLOR="#000077"><I><B>New Term:</B></I></FONT><I><B> </B>List box</I> controlsare used to contain a list of items available for selection. The user can selectitems by using the keyboard or by clicking an individual item using a mouse.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>single selection listbox</I> enables one item to be selected at a time. This is the default style fora list box.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>multiple selection listbox </I>enables multiple items to be selected at one time.</P><P>A list box normally is found in a dialog box, control bar, or other window thatcontains controls. List boxes often are used to contain a large number of items.If some items cannot be displayed, a scrollbar is displayed to help the user navigatethrough the list.<H3><FONT COLOR="#000077"><B>Why Use a List Box?</B></FONT></H3><P>List boxes are the simplest control that enables an arbitrary number of itemsto be displayed to a user. List boxes are often used to display lists of informationthat are extracted from databases or reports. Because the list box doesn't have tobe sized, it is well-suited for this type of data. When a sorted list box is used,it's easy for a user to search through a large number of text items and make a selection.</P><P>List boxes are also extremely easy to program. If you have created a list boxobject, you can add an item to the list box with just one line of code, like this:</P><PRE><FONT COLOR="#0066FF"><TT>listBox.AddString(&quot;Gwen&quot;);</TT></FONT></PRE><P>No other control is as flexible and easy to use for both the programmer and theuser.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>The list box is	also the first control you have seen that uses indexes. Whenever an item is selected,	inserted, or deleted, a zero-based index is used to identify the item. This index	can be synchronized with a database index or used to identify the item in other ways.	<HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>MFC Support for List Boxes</B></FONT></H3><P>You normally add list boxes to a dialog box resource just as you added buttonsand edit controls in the previous two hours. After you have added the control, useClassWizard to add message-handling functions and associate the control with a <TT>CListBox</TT>object.</P><P>You can use the MFC <TT>CListBox</TT> class to manage and interact with the listbox control. Like other control classes, <TT>CListBox</TT> is derived from <TT>CWnd</TT>,and most <TT>CWnd</TT> functions can be used with <TT>CListBox</TT> objects. Youwill see more details about the <TT>CListBox</TT> later, in the section, &quot;Usingthe <TT>CListBox</TT> Class.&quot;<H3><FONT COLOR="#000077"><B>Adding a List Box to a Dialog Box</B></FONT></H3><P>For demonstration purposes, create a dialog box-based project named ListBox usingAppWizard, following the steps presented in Hour 4, &quot;Dialog Boxes and C++ Classes.&quot;Click the ResourceView tab in the project workspace. Open the dialog box editor bydouble-clicking the <TT>IDD_LISTBOX_DIALOG</TT> icon in the Dialog resource folder.</P><P>Adding a list box to <TT>IDD_LISTBOX_DIALOG</TT>, the main dialog box, is justlike adding a button or edit control. Either drag and drop a list box control fromthe control palette to the main dialog box, or select the list box control on thetool palette using the mouse, and click the desired position in the main dialog box.Figure 7.1 shows the <TT>IDD_LISTBOX_DIALOG</TT> with a list box control.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 7.1.</B></A> <I><BR>The main dialog box used in the ListBox sample program.</I></P><P>Open the Properties dialog box for the list box by right-clicking the controland selecting Properties from the shortcut menu. Change the resource ID to <TT>IDC_LIST</TT>.Set all other properties to their default values.<H2><FONT COLOR="#000077"><B>List Box Properties</B></FONT></H2><P>Just like other controls, list boxes have properties that you can configure usingthe Developer Studio resource editor. Some of these properties are available in othercontrols, and some are unique to list boxes. These properties are available for alist box control:<UL>	<LI>ID: Used for the list box resource ID. Developer Studio supplies a default resource	ID, such as <TT>IDC_LIST</TT>.<BR>	<BR>		<LI>Visible: Indicates that the list is initially visible. This check box is normally	checked.<BR>	<BR>		<LI>Disabled: Indicates the list should be initially disabled. This check box is	normally cleared.<BR>	<BR>		<LI>Group: Marks the first control in a group. This check box is normally cleared.<BR>	<BR>		<LI>Tab Stop: Indicates that this control can be reached by pressing the Tab key.	This check box is normally checked.<BR>	<BR>		<LI>Help ID: Creates a context-sensitive help ID for this control.<BR>	<BR>		<LI>Selection: Determines how items in a list box can be selected. A single-selection	list box enables one item to be selected at any given time. Multiple-selection list	boxes enable several selections at once, but ignore the Shift and Control keys. Extended	selection list boxes use the Shift and Control keys during selection.<BR>	<BR>		<LI>Owner Draw: Indicates that the button will be drawn by the button's owner, in	this case the dialog box. In most cases, this option is set to no.<BR>	<BR>		<LI>Has Strings: Specifies that an owner-drawn list box contains strings. All other	list boxes contain strings by default.<BR>	<BR>		<LI>Border: Specifies a border for the list box. This option is enabled by default.<BR>	<BR>		<LI>Sort: Indicates that the list box contents should be sorted. This option is normally	selected.<BR>	<BR>		<LI>Notify: Indicates that notification messages should be sent to the dialog box.	This option is normally selected.<BR>	<BR>		<LI>Multi-Column: Creates a multicolumn list box. This option is normally cleared.<BR>	<BR>		<LI>Horizontal Scroll: Creates a list box with a horizontal scrollbar. This option	is normally cleared.<BR>	<BR>		<LI>Vertical Scroll: Creates a list box with a vertical scrollbar. This option is	normally selected.<BR>	<BR>		<LI>No Redraw: Indicates that the list box should not update its appearance when	its contents are changed. This option is rarely selected and is cleared by default.<BR>	<BR>		<LI>Use Tabstops: Specifies that text items displayed in the list box can contain	tabs. This option is normally cleared.<BR>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本韩国欧美三级| 成人看片黄a免费看在线| 欧美亚洲禁片免费| 伊人婷婷欧美激情| 欧美日韩不卡一区二区| 日韩黄色一级片| 精品久久久久久综合日本欧美| 久久www免费人成看片高清| 2022国产精品视频| 成人手机在线视频| 一区二区三区国产精华| 欧美日本在线一区| 国模套图日韩精品一区二区 | 欧美色偷偷大香| 三级影片在线观看欧美日韩一区二区| 国产午夜精品在线观看| 国产99精品在线观看| 怡红院av一区二区三区| 欧美一区二区三区性视频| 国产精品一区在线观看你懂的| 国产三级久久久| 欧美在线三级电影| 精品一区在线看| 亚洲伦在线观看| 日韩一区二区电影| 99国产精品久久久久久久久久| 亚洲成人激情综合网| 久久久久免费观看| 欧美日韩黄色一区二区| 国产精品羞羞答答xxdd| 亚洲电影一区二区三区| 久久久久九九视频| 欧美视频精品在线观看| 国产精品亚洲一区二区三区妖精| 一区二区三国产精华液| 久久久久久久免费视频了| 欧美午夜片在线看| 国产不卡视频一区二区三区| 一区二区三区不卡在线观看| 久久奇米777| 欧美日韩一区精品| 成a人片亚洲日本久久| 琪琪久久久久日韩精品| 伊人夜夜躁av伊人久久| 中文字幕精品综合| 精品日韩在线一区| 欧美丰满少妇xxxxx高潮对白| 99久久精品免费| 国产成人超碰人人澡人人澡| 免费观看久久久4p| 亚洲图片有声小说| 亚洲视频电影在线| 国产精品视频在线看| www日韩大片| 日韩精品一区国产麻豆| 欧美色图第一页| 色婷婷久久综合| 白白色亚洲国产精品| 韩国女主播一区二区三区| 五月婷婷综合激情| 亚洲一区二区三区四区五区黄| 国产精品久久久久aaaa樱花| 国产婷婷一区二区| 亚洲精品一区二区三区四区高清| 91视频你懂的| 不卡视频在线观看| 成人永久免费视频| 成人永久看片免费视频天堂| 国产成人精品亚洲午夜麻豆| 国产激情一区二区三区桃花岛亚洲| 精品一区二区免费| 九九国产精品视频| 狠狠久久亚洲欧美| 国产九九视频一区二区三区| 国产麻豆视频一区二区| 国产高清在线观看免费不卡| 国产乱码精品一区二区三区忘忧草| 麻豆精品视频在线观看| 美女mm1313爽爽久久久蜜臀| 美国十次了思思久久精品导航| 免费xxxx性欧美18vr| 激情五月激情综合网| 韩国女主播一区二区三区| 韩国精品主播一区二区在线观看 | 色老汉一区二区三区| 成人精品视频一区二区三区 | 欧美日韩精品一区二区三区| 在线精品视频免费观看| 欧美日韩极品在线观看一区| 欧美一三区三区四区免费在线看 | 国产精品久久久久毛片软件| 亚洲手机成人高清视频| 亚洲美女免费视频| 亚洲成a人v欧美综合天堂| 麻豆专区一区二区三区四区五区| 激情综合五月婷婷| 国产成人免费视频一区| 一本色道久久综合亚洲aⅴ蜜桃 | 国产日本一区二区| 中文字幕在线观看一区二区| 一区二区三区蜜桃网| 亚洲第一二三四区| 久久99九九99精品| av在线播放一区二区三区| 色8久久精品久久久久久蜜| 欧美日韩国产a| 久久亚洲精品小早川怜子| 亚洲人成精品久久久久| 亚洲高清免费观看| 国产麻豆精品视频| 色哟哟精品一区| 欧美一个色资源| 欧美极品美女视频| 午夜欧美在线一二页| 精品一区二区三区蜜桃| 色婷婷亚洲精品| 精品国产免费视频| 亚洲午夜久久久久久久久电影院| 精品一区免费av| 欧美性受xxxx| 久久精品免视看| 肉色丝袜一区二区| 99久久99久久免费精品蜜臀| 欧美一区二区三区系列电影| 国产精品免费aⅴ片在线观看| 天天av天天翘天天综合网| 国产综合久久久久久鬼色| 在线观看网站黄不卡| 国产亚洲综合性久久久影院| 亚洲国产视频网站| 成人免费视频播放| 欧美一级生活片| 亚洲精品高清视频在线观看| 国产精品自拍在线| 在线电影一区二区三区| 综合欧美亚洲日本| 国产精品一区二区三区四区| 在线不卡a资源高清| 亚洲日本va午夜在线影院| 国产主播一区二区| 在线播放亚洲一区| 亚洲专区一二三| www.欧美色图| 国产欧美一区二区三区网站 | 丝袜亚洲另类欧美综合| 91在线高清观看| 国产欧美一区在线| 国产一区二区伦理片| 欧美成人女星排行榜| 午夜激情久久久| 色国产综合视频| 国产精品国产三级国产普通话三级| 国产一区二区三区最好精华液| 制服丝袜在线91| 亚洲第一av色| 欧美日韩国产a| 亚洲成人免费电影| 欧美吻胸吃奶大尺度电影| 亚洲欧美日韩一区| 成人av免费在线观看| 亚洲国产高清在线| 国产不卡一区视频| 国产精品毛片a∨一区二区三区| 激情五月激情综合网| 精品精品欲导航| 精品一区二区综合| 久久久久国产精品麻豆ai换脸| 精品一区二区在线看| 久久久久国产精品厨房| 久久精品国产精品亚洲综合| 91蝌蚪porny九色| 亚洲欧美精品午睡沙发| 成人中文字幕在线| 国产精品久久久久久久久免费丝袜 | 亚洲一区二区视频在线| 欧美图区在线视频| 日本中文字幕一区二区视频 | 久久久亚洲综合| 国产老妇另类xxxxx| 国产精品久久久99| 色国产综合视频| 日韩av高清在线观看| 日韩美女主播在线视频一区二区三区| 麻豆精品视频在线观看免费| 久久精品欧美一区二区三区麻豆| 粉嫩欧美一区二区三区高清影视 | 久久久综合九色合综国产精品| 国内精品嫩模私拍在线| 国产精品色婷婷久久58| 在线一区二区三区四区五区| 日本免费在线视频不卡一不卡二| 精品奇米国产一区二区三区| 国产高清在线精品| 一区二区三区精品| 精品捆绑美女sm三区| 成人av免费在线观看| 亚洲成av人片观看| 欧美经典三级视频一区二区三区| 91福利精品第一导航| 日本不卡免费在线视频|