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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch06.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 6 -- Using Edit 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="../ch05/ch05.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch07/ch07.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 6 -<BR>Using Edit Controls</FONT></H1></CENTER><P>In Windows programs, user input is often collected using edit controls. In thishour you will also learn about<UL>	<LI>Identifier scope and lifetime, an important topic for C++ programming<BR>	<BR>		<LI>Using edit controls to collect and display free-form text supplied by the user<BR>	<BR>		<LI>Associating an edit control with <TT>CEdit</TT> and <TT>CString</TT> objects	using ClassWizard<BR>	<BR>		<LI>Using DDV and DDX routines for data validation and verification</UL><P>You will also create an SDI project and use it to show how data is transferredin and out of edit controls used in dialog boxes.<H2><FONT COLOR="#000077"><B>Identifier Scope and Lifetime</B></FONT></H2><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>The <I>scope</I> of an identifierrefers to its visibility in a C++ program.</P><P>Every identifier used to name a variable or function has a specific scope whenit is created, and this scope determines how and where that name can be used. Ifa variable is &quot;in scope&quot; at a certain point in a program, it is visibleand can be used in most circumstances. If it is &quot;out of scope,&quot; it is notvisible, and your program will not be capable of using that variable.</P><P>One simple type of scope is shown in the following code sample. The followingcode is not legal because the variable <TT>myAge</TT> is used before it is declared:</P><PRE><FONT COLOR="#0066FF"><TT>myAge = 12;</TT><TT>int myAge;</TT></FONT></PRE><P>Because the identifier <TT>myAge</TT> is not in the current scope, it cannot beassigned a value.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>The preceding example	illustrates one simple property about visibility: it almost always runs &quot;downward,&quot;	beginning at the point where the variable is declared. There are also several different	types of scope, ranging from very small to very large. <HR></P>	<P><HR><B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>In general, your program	should use variables that have as small a scope as possible. The smaller the scope,	the less chance that an identifier will be accidentally misused or subjected to side	effects. For example, passing objects as parameters to a function is always better	than relying on global variables. Using variables that are local to the function	helps make the function more reusable. <HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>Using Different Types of Scope</B></FONT></H3><P>The scope of an identifier comes into play whenever an identifier is declared.The most commonly used types of scope available in a C++ program are<UL>	<LI>Local scope	<LI>Function scope	<LI>Class scope</UL><P>Each of these types of scope is discussed in the following sections.<H4><FONT COLOR="#000077">Local Scope</FONT></H4><P>The simplest example of local scope is a variable or other object that is declaredoutside any functions, like this:</P><PRE><FONT COLOR="#0066FF"><TT>int foo;</TT><TT>int main()</TT><TT>{</TT><TT>    return 0;</TT><TT>}</TT></FONT></PRE><P>In this example, the variable <TT>foo</TT> is in scope from the point of its declarationto the end of the source file. For this reason, this type of local scope is sometimescalled <I>file scope</I>. All declarations that occur outside class or function definitionshave this type of scope.</P><P>Variables declared inside a function body have local scope and are visible onlywithin the function.</P><P>Another type of local scope is <I>block scope</I>, where a variable within a compoundstatement or other block is visible until the end of the block, as shown in Listing6.1.<H4><FONT COLOR="#000077">TYPE: Listing 6.1. An example of local block scope.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>if( bPrinting == true)</TT><TT>{</TT><TT>    int nMyAge = 42;</TT><TT>    cout &lt;&lt; &quot;My age is &quot; &lt;&lt; nMyAge &lt;&lt; endl;</TT><TT>}</TT><TT>// nMyAge is not in scope here.</TT></FONT></PRE><P>The variable <TT>nMyAge</TT> has block scope and can be used only between thecurly braces.<H4><FONT COLOR="#000077">Function Scope</FONT></H4><P>Function scope is rarely an issue. <I>Function scope</I> applies to labels declaredinside a function definition. The only time you would use a label is with the widelydiscouraged <TT>goto</TT> statement.</P><P>None of the labels declared in a function are visible outside the function. Thismeans that the C++ language does not directly support jumping to a label outsidethe current function. It also means that you can reuse labels in different functions.<H4><FONT COLOR="#000077">Class Scope</FONT></H4><P>All identifiers used in a class, union, or structure are tightly associated withthe class and have <I>class scope</I>. An identifier with class scope can be usedanywhere within the class, union, or structure.</P><P>If a class or variable name is used to qualify access to the identifier, it alsois visible outside the class. For example, if a class is defined as follows, thevariables <TT>m_myVar</TT> and <TT>m_myStaticVar</TT> are in scope for all the <TT>CFoo</TT>member functions:</P><PRE><FONT COLOR="#0066FF"><TT>// class CFoo</TT><TT>class CFoo</TT><TT>{</TT><TT>public:</TT><TT>    CFoo();</TT><TT>    int     GetMyVar();</TT><TT>    int     GetStaticVar();</TT><TT>    int        m_myVar;</TT><TT>    static int m_myStaticVar;</TT><TT>};</TT><TT>int CFoo::m_myStaticVar;</TT></FONT></PRE><P>Outside the <TT>CFoo</TT> class, the variables can be accessed only through a<TT>CFoo</TT> object, like this:</P><PRE><FONT COLOR="#0066FF"><TT>aFoo.m_myVar = 42;</TT></FONT></PRE><P>There is one exception to the rule that requires a member to be accessed witha variable name: A class member declared as <I>static</I> is shared by all objectsof that class. Static members of a class exist even when no objects of a class havebeen created. To access a static class member without using a class object, prefixthe class name to the member name, like this:</P><PRE><FONT COLOR="#0066FF"><TT>CFoo::m_myStaticVar = 1;</TT></FONT></PRE><H3><FONT COLOR="#000077"><B>Understanding Identifier Lifetime</B></FONT></H3><P>In a C++ program, every variable or object has a specific lifetime, which is separatefrom its visibility. It is possible for you to determine when a variable is createdand when it is destroyed.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>Lifetime can be	an important issue when you design your program. Large objects can be costly to create	and destroy. By understanding the lifetime of objects created in your programs, you	can take advantage of features in the C++ language that help your programs run more	efficiently. <HR></BLOCKQUOTE><H4><FONT COLOR="#000077">Static Lifetime</FONT></H4><P>A variable declared as <TT>static</TT> in a function is created when the programstarts and is not destroyed until the program ends. This is useful when you wantthe variable or object to remember its value between function calls. Listing 6.2is an example of a static object in a function.<H4><FONT COLOR="#000077">TYPE: Listing 6.2. A static object in a function, destroyedwhen the program ends.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>#include &lt;iostream&gt;</TT><TT>using namespace std;</TT><TT>void PrintMessage();</TT><TT>int main()</TT><TT>{</TT><TT>    for( int nMessage = 0; nMessage &lt; 10; nMessage++ )</TT><TT>        PrintMessage();</TT><TT>    return 0;</TT><TT>}</TT><TT>void PrintMessage()</TT><TT>{</TT><TT>    static int nLines = 1;</TT><TT>    cout &lt;&lt; &quot;I have printed &quot; &lt;&lt; nLines &lt;&lt; &quot; lines.&quot; &lt;&lt; endl;</TT><TT>    nLines++;</TT><TT>}</TT></FONT></PRE><H2><FONT COLOR="#000077"><B>Understanding Edit Controls</B></FONT></H2><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An <I>edit control</I> isa window used to store free-form text input by a user.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>single-line edit control</I>is an edit control that enables a single line of text to be entered.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>multiple-line edit control</I>,sometimes called an <I>MLE</I>, is an edit control that enables multiple lines oftext to be entered.</P><P>Edit controls are usually found in dialog boxes. Almost anywhere user input isrequired, you can usually find an edit control.<H3><FONT COLOR="#000077"><B>Why Use an Edit Control?</B></FONT></H3><P>Single-line edit controls are used when text must be collected. For example, whena name or address must be entered in a dialog box, an edit control is used to collectthat information. Multiline edit controls often use scrollbars that enable more textto be entered than can be displayed.</P><P>A prompt in the form of default text can be provided for an edit control. In somesituations, this can reduce the amount of typing required by a user. All edit controlsalso support a limited amount of editing, without any need for extra programmingon your part. For example, the standard cut-and-paste commands work as expected inan edit control. Table 6.1 lists the editing commands available in an edit control.<H4><FONT COLOR="#000077">Table 6.1. Editing commands available in an edit control.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT"><B>Command</B></TD>		<TD ALIGN="LEFT"><B>Keystroke</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">Cut</TD>		<TD ALIGN="LEFT">Control+X</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">Paste</TD>		<TD ALIGN="LEFT">Control+V</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">Copy</TD>		<TD ALIGN="LEFT">Control+C</TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT">Undo</TD>		<TD ALIGN="LEFT">Control+Z</TD>	</TR></TABLE><BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>Because of the	built-in editing capabilities of the edit control, it's possible to create a simple	text editor using a multiple-line edit control. Although an MLE cannot replace a	real text editor, it does provide a simple way to collect multiple lines of text	from a user. <HR></BLOCKQUOTE>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品美女一区二区三区| 成人亚洲一区二区一| 欧美日韩一区二区三区免费看 | 国产欧美日本一区视频| 国产成人亚洲综合a∨婷婷| 99久久婷婷国产综合精品电影| 国产精品女主播av| 色婷婷综合久久久| 亚洲不卡在线观看| 欧美一区二区在线免费播放| 麻豆一区二区在线| 久久精品一区八戒影视| 成人av在线资源| 亚洲一区二区综合| 欧美一级高清大全免费观看| 国产在线精品一区二区不卡了 | 成人精品视频一区二区三区| 日本一区二区三级电影在线观看 | 亚洲美女视频在线| 欧美精品乱人伦久久久久久| 精品午夜久久福利影院| 中文字幕一区二区三区四区不卡 | 国产黄色成人av| 亚洲男人的天堂av| 日韩欧美中文一区二区| 成人黄色免费短视频| 手机精品视频在线观看| 日韩精品在线网站| 色婷婷香蕉在线一区二区| 日韩av成人高清| 中文字幕亚洲在| 日韩精品中文字幕一区二区三区| 99久久夜色精品国产网站| 蜜桃av噜噜一区二区三区小说| 国产精品久久久久婷婷二区次| 欧美日韩另类国产亚洲欧美一级| 国内外精品视频| 亚洲一区二区五区| 国产欧美日本一区二区三区| 欧美高清性hdvideosex| 91同城在线观看| 国产一区二区三区精品欧美日韩一区二区三区| 欧美激情在线一区二区三区| 欧美日韩激情在线| 成人a区在线观看| 极品瑜伽女神91| 亚洲成人av资源| 亚洲视频一区二区免费在线观看| 日韩片之四级片| 欧美日韩亚洲另类| 99精品视频在线观看免费| 精品在线你懂的| 日韩精品亚洲一区| 亚洲自拍与偷拍| 亚洲特黄一级片| 日本一区二区三区高清不卡| 精品福利一二区| 欧美精品一级二级| 欧美午夜精品久久久久久超碰| 国产高清不卡一区二区| 久久成人综合网| 美洲天堂一区二卡三卡四卡视频| 性久久久久久久久| 亚洲五码中文字幕| 亚洲精品亚洲人成人网在线播放| 国产精品久久午夜| 国产亚洲美州欧州综合国| 欧美一区二区视频观看视频| 7777女厕盗摄久久久| 欧美日韩一二三| 欧美日韩高清影院| 欧美色图免费看| 91精品办公室少妇高潮对白| 成人ar影院免费观看视频| 成人综合激情网| 国产v日产∨综合v精品视频| 国产成人亚洲综合色影视| 国产sm精品调教视频网站| 国产精品亚洲一区二区三区在线 | 91同城在线观看| 欧美剧情电影在线观看完整版免费励志电影| 国产精品亚洲а∨天堂免在线| 黄网站免费久久| 国产高清亚洲一区| 成人aa视频在线观看| 99re66热这里只有精品3直播 | 欧美日韩aaaaaa| 911精品产国品一二三产区| 欧美老年两性高潮| 欧美大胆人体bbbb| 精品成人佐山爱一区二区| 久久久久久电影| 日韩一区在线播放| 亚洲成人你懂的| 美女看a上一区| 国产美女一区二区三区| 成人小视频在线| 欧美性高清videossexo| 日韩一区二区在线观看视频| 久久精品视频免费| 综合电影一区二区三区 | 91精品福利在线| 欧美区一区二区三区| 日韩欧美精品三级| 中日韩免费视频中文字幕| 亚洲精品一卡二卡| 日韩av中文字幕一区二区| 国产精品一区一区三区| 91啪九色porn原创视频在线观看| 欧美日韩国产a| 久久久久久免费网| 亚洲一区二区五区| 国精产品一区一区三区mba桃花| 9i看片成人免费高清| 欧美三级视频在线播放| 久久蜜桃av一区精品变态类天堂| 亚洲欧美日韩人成在线播放| 日本强好片久久久久久aaa| 成人久久久精品乱码一区二区三区| 欧美在线免费观看亚洲| 精品福利一二区| 亚洲愉拍自拍另类高清精品| 国产乱一区二区| 欧美日韩视频在线第一区 | 色综合天天综合网国产成人综合天| 欧美日韩精品系列| 亚洲国产精品av| 美女视频免费一区| 欧美在线你懂得| 国产精品久久久久久久久免费丝袜 | 91国产精品成人| 国产亚洲美州欧州综合国| 亚洲午夜羞羞片| 青青草国产成人99久久| 亚洲色图.com| 久久99热这里只有精品| 91亚洲国产成人精品一区二区三| 日韩美女在线视频| 亚洲成va人在线观看| 99久久免费国产| 久久青草国产手机看片福利盒子 | 亚洲成人av一区二区三区| 成人久久视频在线观看| 亚洲精品在线一区二区| 亚洲电影一区二区| 91美女视频网站| 亚洲国产精品高清| 国内不卡的二区三区中文字幕| 欧美老女人第四色| 亚洲国产成人av网| 欧美亚洲国产一区在线观看网站| 国产精品久久久久一区二区三区共| 久久er99热精品一区二区| 91精品国产欧美一区二区| 亚洲尤物在线视频观看| 色久综合一二码| 成人欧美一区二区三区在线播放| 国产成人午夜精品影院观看视频| 日韩一级高清毛片| 欧美在线观看禁18| 91免费国产在线| 国产日韩精品一区二区三区| 美腿丝袜在线亚洲一区| 欧美精品乱人伦久久久久久| 亚洲福利视频一区二区| 欧美日韩一区二区欧美激情 | 欧美一区二区三区性视频| 偷偷要91色婷婷| 欧美日韩国产天堂| 三级在线观看一区二区| 欧美妇女性影城| 久久国产精品第一页| www国产精品av| 国产精品18久久久久久久久 | 欧美久久久影院| 偷拍与自拍一区| 欧美日韩国产一区二区三区地区| 亚洲成人在线免费| 欧美亚洲国产怡红院影院| 99视频一区二区| 樱花影视一区二区| 欧美日本在线一区| 日本最新不卡在线| 精品粉嫩超白一线天av| 国产精品一区三区| 日韩毛片精品高清免费| 欧美午夜寂寞影院| 日本成人中文字幕在线视频 | 欧美午夜精品一区二区蜜桃| 三级影片在线观看欧美日韩一区二区| 欧美老肥妇做.爰bbww| 精东粉嫩av免费一区二区三区| 国产精品网站在线观看| 在线观看日韩毛片| 麻豆精品在线播放| 欧美激情中文字幕| 欧美日韩免费不卡视频一区二区三区| 久久精品久久精品| 中文字幕视频一区| 欧美理论电影在线|