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

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

?? ch06.htm

?? 24小時(shí)精通VC
?? HTM
?? 第 1 頁 / 共 3 頁
字號(hào):
<!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>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品日韩一| 麻豆91小视频| 精品国产sm最大网站| 91女神在线视频| 毛片基地黄久久久久久天堂| 亚洲欧美视频一区| 日韩精品一区二区三区视频播放| 91捆绑美女网站| 精品午夜一区二区三区在线观看| 亚洲女同ⅹxx女同tv| 久久久久久久久久久99999| 欧美无砖专区一中文字| 成人免费视频网站在线观看| 男女激情视频一区| 亚洲一区二区精品视频| 国产精品成人在线观看| 精品国产乱码久久久久久蜜臀| 91福利国产成人精品照片| 国产自产视频一区二区三区| 日韩av一区二区三区| 亚洲综合偷拍欧美一区色| 国产欧美一区视频| 日韩欧美一区二区久久婷婷| 91黄色免费观看| 99久久99久久综合| 高清在线成人网| 久久99精品久久只有精品| 亚洲一区二区三区四区在线免费观看 | 一区二区三国产精华液| 久久久综合九色合综国产精品| 欧美久久婷婷综合色| 色8久久人人97超碰香蕉987| 成人av资源在线观看| 国产成人日日夜夜| 狠狠色狠狠色综合系列| 久久99国产精品尤物| 日本成人在线电影网| 视频一区二区三区中文字幕| 亚洲一区二区视频| 一区二区高清视频在线观看| 综合婷婷亚洲小说| 亚洲蜜桃精久久久久久久| 国产精品久线在线观看| 国产精品毛片久久久久久久| 中文字幕av一区二区三区| 国产精品毛片久久久久久| 欧美激情中文字幕| 国产精品免费观看视频| 成人免费在线视频观看| 中文字幕一区av| 亚洲精品少妇30p| 亚洲一区二区三区中文字幕| 亚洲成a人片综合在线| 日韩精品国产精品| 蜜桃av一区二区在线观看| 另类小说综合欧美亚洲| 日本sm残虐另类| 久久精品国产99| 国产精品123区| 99在线精品免费| 色老汉av一区二区三区| 欧美午夜精品免费| 日韩天堂在线观看| 国产欧美日韩亚州综合| 亚洲欧美视频在线观看视频| 亚洲宅男天堂在线观看无病毒| 婷婷综合五月天| 蜜桃久久av一区| 国产91精品免费| 91欧美一区二区| 6080日韩午夜伦伦午夜伦| 亚洲精品一区二区三区影院| 国产精品久久久久影视| 亚洲成av人片在www色猫咪| 看国产成人h片视频| 国产aⅴ综合色| 色94色欧美sute亚洲13| 欧美电影免费观看高清完整版在线观看 | 麻豆高清免费国产一区| 国产精华液一区二区三区| 色综合久久综合中文综合网| 91精品国产综合久久久蜜臀图片| 久久综合成人精品亚洲另类欧美| 国产精品久久久久久福利一牛影视| 艳妇臀荡乳欲伦亚洲一区| 久久国产视频网| 99麻豆久久久国产精品免费| 欧美日韩精品欧美日韩精品一 | 日本91福利区| 国产高清亚洲一区| 欧美色图在线观看| 国产亚洲婷婷免费| 亚洲综合激情另类小说区| 国产精一品亚洲二区在线视频| 色94色欧美sute亚洲线路一ni| 精品国产乱码久久久久久久久 | 欧美日韩一区二区三区四区五区| 精品国产a毛片| 亚洲午夜免费电影| 成人午夜电影小说| 欧美一卡在线观看| 亚洲欧美日韩在线| 国内精品久久久久影院色| 在线观看亚洲精品视频| 久久精品视频在线看| 婷婷开心久久网| 91视频在线观看免费| 久久久午夜精品| 日韩精品一卡二卡三卡四卡无卡| 99精品在线观看视频| 久久久不卡网国产精品二区| 日韩精品乱码免费| 日本大香伊一区二区三区| 国产日韩亚洲欧美综合| 蜜桃久久久久久| 在线观看91av| 亚洲一区影音先锋| 色综合色综合色综合色综合色综合| 欧美大胆人体bbbb| 日本特黄久久久高潮| 欧美日韩一区二区三区在线看| 亚洲欧美电影一区二区| 丁香六月综合激情| 久久精品一区八戒影视| 欧美a一区二区| 欧美日韩国产欧美日美国产精品| 亚洲视频在线一区观看| 懂色一区二区三区免费观看| 久久精品人人做人人综合| 免费成人美女在线观看| 欧美猛男男办公室激情| 亚洲一二三区视频在线观看| 日本福利一区二区| 亚洲女性喷水在线观看一区| 成人免费视频app| 久久久久久毛片| 国产精品18久久久久久久久久久久 | 精品国产污污免费网站入口 | 最新国产精品久久精品| 成人黄色大片在线观看| 久久综合色之久久综合| 国产一区欧美二区| 精品国产一区二区三区四区四 | 成人性生交大片免费看视频在线| 日韩精品一区二区三区中文不卡 | 亚洲美女在线国产| 色女孩综合影院| 亚洲二区在线观看| 欧美日韩精品一区二区三区四区| 天堂在线一区二区| 欧美一卡二卡在线| 精品亚洲国内自在自线福利| 亚洲精品一区二区精华| 国产白丝精品91爽爽久久| 国产精品国产馆在线真实露脸| 99在线精品一区二区三区| 亚洲精品写真福利| 欧美三级中文字幕| 麻豆91精品91久久久的内涵| ww亚洲ww在线观看国产| 成人va在线观看| 亚洲精品你懂的| 欧美群妇大交群中文字幕| 蜜桃av噜噜一区| 国产天堂亚洲国产碰碰| 91免费在线视频观看| 亚洲高清免费观看 | 一区二区三区四区在线免费观看 | 日韩欧美中文字幕一区| 精品一区二区三区免费| 国产精品全国免费观看高清| 色88888久久久久久影院按摩| 一区二区日韩av| 日韩久久久精品| k8久久久一区二区三区| 亚洲一区在线观看免费| 精品美女被调教视频大全网站| 国产精品12区| 亚洲成人免费电影| 久久久亚洲综合| 欧美系列在线观看| 国产一区二区美女诱惑| 亚洲精品综合在线| 精品久久久久久久久久久久包黑料| 国产99一区视频免费| 亚洲h在线观看| 中文字幕精品一区二区三区精品| 欧美艳星brazzers| 国产精品一级片| 亚洲一区二区三区在线看| 久久精品视频一区| 欧美人xxxx| 97久久精品人人爽人人爽蜜臀 | 粉嫩在线一区二区三区视频| 亚洲一区二区免费视频| 亚洲国产精品成人综合 | 欧美色精品在线视频| 国产大片一区二区| 全部av―极品视觉盛宴亚洲| 国产精品久久毛片|