亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲妇熟xx妇色黄| 欧美电影在线免费观看| 亚洲天堂网中文字| 91啪亚洲精品| 天天综合天天做天天综合| 51精品视频一区二区三区| 美女视频一区二区三区| 久久综合色8888| 国产99久久久久| 夜夜嗨av一区二区三区网页| 欧美午夜寂寞影院| 裸体歌舞表演一区二区| 国产亚洲精品久| 日本精品一区二区三区高清| 日韩黄色在线观看| 337p日本欧洲亚洲大胆精品| 成人深夜福利app| 亚洲一级电影视频| 日韩写真欧美这视频| 国产成人精品一区二区三区四区| 国产精品美女久久久久久久久| 欧洲视频一区二区| 天堂av在线一区| 国产日产亚洲精品系列| 91久久香蕉国产日韩欧美9色| 日韩精品亚洲一区二区三区免费| 久久精品夜夜夜夜久久| 色综合久久久久久久久| 日韩国产精品91| 国产欧美一区二区在线| 欧美亚洲日本一区| 国产很黄免费观看久久| 亚洲一区在线观看免费| 精品国产免费一区二区三区香蕉 | 欧美日韩一区二区三区在线看| 美女精品一区二区| 18欧美乱大交hd1984| 欧美刺激午夜性久久久久久久| 91年精品国产| 国产精品自拍网站| 亚洲1区2区3区视频| 国产视频一区二区在线观看| 欧美精品一二三区| 99国产精品国产精品久久| 蜜桃久久av一区| 亚洲专区一二三| 久久精品一级爱片| 日韩区在线观看| 欧美最猛性xxxxx直播| 丁香啪啪综合成人亚洲小说 | 日本一区二区三区电影| 制服丝袜成人动漫| 在线观看网站黄不卡| 国产99久久久国产精品潘金| 免费观看在线色综合| 一区二区三区中文在线观看| 欧美国产欧美综合| 亚洲精品一区二区三区99 | 欧美蜜桃一区二区三区| 成人免费视频播放| 国产丶欧美丶日本不卡视频| 麻豆精品一区二区三区| 日韩成人av影视| 国产人成亚洲第一网站在线播放| 色综合久久综合网欧美综合网| 亚洲一区二区三区中文字幕在线 | 欧美在线你懂得| 成人av网址在线| 国产成人av资源| 韩国欧美一区二区| 美腿丝袜亚洲综合| 久久精品国产99| 午夜日韩在线观看| 亚洲午夜免费视频| 午夜影院在线观看欧美| 亚洲第一主播视频| 亚洲成人一区在线| 石原莉奈一区二区三区在线观看| 午夜精品久久久久久不卡8050| 亚洲女性喷水在线观看一区| 最新日韩av在线| 亚洲欧洲综合另类在线| 一卡二卡欧美日韩| 一级做a爱片久久| 日韩激情中文字幕| 激情综合一区二区三区| 国产乱对白刺激视频不卡| 日韩成人精品视频| 视频一区免费在线观看| 最好看的中文字幕久久| 日本一区二区三级电影在线观看 | 777午夜精品免费视频| 538在线一区二区精品国产| 欧美一级二级在线观看| 日韩精品一区二区在线| 久久精品一区蜜桃臀影院| 中文一区一区三区高中清不卡| 国产精品午夜电影| 欧美综合一区二区| 国产色91在线| 欧美日韩一区二区三区在线看| 7777精品伊人久久久大香线蕉超级流畅 | 欧美一区二区三区四区视频| 亚洲大型综合色站| jlzzjlzz国产精品久久| 亚洲天堂免费在线观看视频| 亚洲天堂免费看| 天天影视涩香欲综合网| 日本成人中文字幕| 成人自拍视频在线| 欧美日韩在线一区二区| 日韩一级二级三级精品视频| 国产亚洲女人久久久久毛片| 亚洲免费观看高清完整版在线观看| 亚洲一二三专区| 国产传媒欧美日韩成人| 欧美性大战久久久久久久| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 成人亚洲一区二区一| 在线国产亚洲欧美| 久久免费美女视频| 亚洲乱码国产乱码精品精的特点| 青青草国产成人99久久| 成人18精品视频| 91精品免费在线观看| 国产精品美女视频| 日韩电影一区二区三区四区| 成人中文字幕合集| 婷婷国产在线综合| 国产激情精品久久久第一区二区| 欧美高清激情brazzers| www激情久久| 国产98色在线|日韩| 欧美xxx久久| 国产精品成人一区二区艾草| 亚洲婷婷国产精品电影人久久| 蜜乳av一区二区| 色噜噜夜夜夜综合网| 久久精品这里都是精品| 日韩高清不卡在线| 91伊人久久大香线蕉| 国产日产欧产精品推荐色| 丝袜a∨在线一区二区三区不卡| 99国产精品99久久久久久| 久久综合色婷婷| 日本不卡一区二区三区| 欧美探花视频资源| 日韩理论片一区二区| 风间由美一区二区av101| 精品国产sm最大网站免费看| 日本亚洲视频在线| 欧美日韩mp4| 亚洲电影第三页| 一区二区三区欧美日韩| 欧美人成免费网站| 在线91免费看| 久久久五月婷婷| 精品一区二区三区在线视频| 欧美剧情电影在线观看完整版免费励志电影| 亚洲国产精品高清| 国产馆精品极品| 久久综合久久综合亚洲| 久久se精品一区精品二区| 欧美日韩视频在线观看一区二区三区 | 亚洲人妖av一区二区| 懂色av中文字幕一区二区三区| 欧美电视剧在线观看完整版| 蜜桃av噜噜一区二区三区小说| 欧美精品vⅰdeose4hd| 日韩不卡一区二区| 欧美一级黄色大片| 久久精品国产久精国产爱| 日韩一二三四区| 国产在线播放一区二区三区| 精品国产不卡一区二区三区| 国产一区二区三区综合| 国产日本亚洲高清| 9久草视频在线视频精品| 中文字幕在线视频一区| 一本在线高清不卡dvd| 一二三区精品福利视频| 欧美在线免费播放| 日本欧美一区二区三区| 26uuu精品一区二区三区四区在线| 国产九九视频一区二区三区| 国产欧美精品区一区二区三区| 99久久精品国产一区| 亚洲一区二区视频在线| 日韩欧美综合一区| 国产99久久久国产精品| 亚洲精品视频自拍| 欧美理论片在线| 国产激情视频一区二区三区欧美| 中文字幕在线不卡视频| 在线观看中文字幕不卡| 久久国产综合精品| √…a在线天堂一区| 7777精品伊人久久久大香线蕉的| 国产一区二区三区电影在线观看| 国产精品久久午夜|