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

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

?? ch06.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
<P>One difference between edit controls and the pushbutton controls you saw in Hour5, &quot;Button Controls,&quot; is that a button control is normally used to generateevents. An edit control can generate events also, but it most often is used to actuallystore data.<H3><FONT COLOR="#000077"><B>MFC Support for Edit Controls</B></FONT></H3><P>You normally add edit controls to a dialog box just as you added buttons in Hour5. After you add the control to a dialog box, use ClassWizard to configure the controlfor use in the program.</P><P>The MFC class <TT>CEdit</TT> is often used to interact with edit controls. Asyou will see in the next section, you can use ClassWizard to associate an edit controlwith a specific <TT>CEdit</TT> object. An edit control can also be associated witha <TT>CString</TT> object, which can simplify the use of edit controls in dialogboxes. You will learn about using edit controls associated with <TT>CString</TT>objects in detail beginning with the section &quot;Passing Parameters to Dialog BoxesUsing DDV and DDX Routines,&quot; later in this hour.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>Of course, edit	controls can be used in dialog box-based programs, which were discussed in Hour 5.	However, in this hour an SDI program is used to show off some of the data exchange	and validation features often used with edit controls. <HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>Building an SDI Test Project</B></FONT></H3><P>Some of the sample programs in this book require you to build an SDI project andadd a test dialog box. You can use the following steps to build a test project thatincludes a test dialog box:<DL>	<DD>1. Create an SDI project named EditTest using MFC AppWizard, as discussed in	Hour 1, &quot;Introducing Visual C++ 5.&quot; Feel free to add or remove any of the	optional features suggested by AppWizard, because they aren't used in this hour.<BR>	<BR>	2. As discussed in Hour 4, &quot;Dialog Boxes and C++ Classes,&quot; add a dialog	box resource to the program. Name the dialog box <TT>IDD_TEST</TT>, and set the caption	to Test Dialog. Using ClassWizard, create a dialog box class called <TT>CTestDlg</TT>	for the new dialog box.<BR>	<BR>	3. Add a menu choice named <TT>ID_VIEW_TEST</TT>, with a caption of Test... that	brings up the Edit dialog box by adding a new menu choice on the View menu. Add a	message-handling function for the new menu item using ClassWizard. The steps required	to add a message-handling function that uses a <TT>CDialog</TT>-based object were	discussed in Hour 4. Use the source code provided in Listing 6.3 for the <TT>CMainFrame</TT>	message-handling function.<BR>	<BR>	4. Include the class declaration for <TT>CTestDlg</TT> in the <TT>MainFrm.cpp</TT>	file by adding the following line after all the <TT>#include</TT> directives in <TT>MainFrm.cpp</TT>:</DL><BLOCKQUOTE>	<PRE><FONT COLOR="#0066FF"><TT>#include &quot;testdlg.h&quot;</TT></FONT></PRE></BLOCKQUOTE><DL>	<DD>5. Add a pushbutton control, <TT>IDC_TEST</TT>, labeled Test, to the dialog box,	as was done in Hour 5. Using ClassWizard, add a function that handles the <TT>BN_CLICKED</TT>	message, which will be used in later examples.<BR>	<BR>	6. After following these steps, make sure that the project compiles properly by pressing	the Build icon on the toolbar or by selecting Build|Build EditTest.exe from the main	menu. Try the menu item to make sure the <TT>IDC_TEST</TT> dialog box is displayed	when View|Test... is selected.</DL><H4><FONT COLOR="#000077">TYPE: Listing 6.3. Handling a menu-item selection for EditTest.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CMainFrame::OnViewTest()</TT><TT>{</TT><TT>    CTestDlg    dlg;</TT><TT>    dlg.DoModal();</TT><TT>}</TT></FONT></PRE><H3><FONT COLOR="#000077"><B>Adding an Edit Control to a Dialog Box</B></FONT></H3><P>You add an edit control to a dialog box just as you added a button control inHour 5, using either of these two basic methods:<UL>	<LI>Using drag-and-drop, drag an edit control from the control palette and drop at	a desirable location in the dialog box.<BR>	<BR>		<LI>Select an edit control by clicking the Edit Control icon in the tool palette,	and click over the location in the dialog box where the edit control should be located.</UL><P>Arrange the edit control so that the dialog box resembles the one in Figure 6.1.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 6.1.</B> </A><I><BR>The dialog box used in the edit control examples.</I></P><P>In Figure 6.1, a static text control is located immediately to the left of theedit control. Edit controls are usually labeled with static text so a user can determinethe type of input needed. Static text controls were discussed in Hour 4. The ID forthe new edit control is set by default to <TT>IDC_EDIT1</TT> or a similar name. Changethe ID to <TT>IDC_EDIT_TEST</TT>, leaving the other properties set to their defaultvalues.<H2><FONT COLOR="#000077"><B>Edit Control Properties</B></FONT></H2><P>You can examine the properties for an edit control, just as with other resources,by right-clicking over the control and selecting Properties from the pop-up menu.These general properties are available for an edit control:<UL>	<LI>ID: Used for the edit control's resource ID. Like other controls, a default resource	ID is supplied by Developer Studio.<BR>	<BR>		<LI>Visible: Indicates that the edit control is initially visible. This option is	normally selected.<BR>	<BR>		<LI>Disabled: Indicates that the edit control should be initially disabled. This	option is not normally selected.<BR>	<BR>		<LI>Group: Used to mark the first control in a group. All controls following a control	with this attribute are considered part of the same group if the attribute is cleared.	A user can move between controls in the same group using the arrow keys.<BR>	<BR>		<LI>Help ID: Creates a context-sensitive help ID for this control.<BR>	<BR>		<LI>Tab Stop: Indicates that this control can be reached by pressing the Tab key.	This option is normally selected.</UL><P>There also is a group of properties that apply specifically to edit controls.The following properties are displayed by clicking the Styles tab in the Propertiesdialog box:<UL>	<LI>Align Text: A drop-down list box that is enabled if the edit control is an MLE.	The text can be aligned to the left, center, or right, with left as the default.<BR>	<BR>		<LI>Multiline: Defines the control as an MLE. This option is not selected by default.<BR>	<BR>		<LI>Number: Restricts the edit control to digits only. This feature is available	only in Windows 95 or Windows NT version 3.51 or later.<BR>	<BR>		<LI>Horizontal Scroll: Enabled only for an MLE and provides a horizontal scrollbar.	The option is not selected by default.<BR>	<BR>		<LI>Auto HScroll: Scrolls text to the right if needed. This option is normally selected.<BR>	<BR>		<LI>Vertical Scroll: Enabled only for an MLE and provides a vertical scrollbar. The	option is not selected by default.<BR>	<BR>		<LI>Auto VScroll: Enabled only for an MLE and provides automatic scrolling when the	user presses Return on the last line. The option is not selected by default.<BR>	<BR>		<LI>Password: Hides the user's input by displaying an asterisk instead of each character.	This option is available only in single-line controls and is not selected by default.<BR>	<BR>		<LI>No Hide Selection: Changes the way an edit control handles the focus. When this	option is enabled, text appears to be selected at all times. This option is not selected	by default.<BR>	<BR>		<LI>OEM Convert: Performs conversions on the user's input so that the <TT>AnsiToOem</TT>	function works correctly if called by your program. This option is not selected by	default.<BR>	<BR>		<LI>Want Return: Applies to MLE controls. This option allows an edit control to accept	an Enter keypress, so that an Enter keypress doesn't affect the dialog box's default	pushbutton.	<LI>Border: Creates a border around the control. This option is selected by default.<BR>	<BR>		<LI>Uppercase: Converts all input to uppercase characters. This option is not selected	by default.<BR>	<BR>		<LI>Lowercase: Converts all input to lowercase characters. This option is not selected	by default.<BR>	<BR>		<LI>Read-only: Prevents the user from typing or editing text in the edit control.	This option is not selected by default.</UL><H2><FONT COLOR="#000077"><B>Binding a <TT>CEdit</TT> Object to an Edit Control</B></FONT></H2><P>As discussed earlier, one way to interact with an edit control is through a <TT>CEdit</TT>object that is attached to the control. To attach a <TT>CEdit</TT> object to an editcontrol, you use ClassWizard much as you did for button controls in the previoushour:<DL>	<DD>1. Open ClassWizard.<BR>	<BR>	2. Select the <TT>CDialog</TT>-derived class that manages the dialog box; in this	case, <TT>CTestDlg</TT>.<BR>	<BR>	3. Select the tab labeled Member Variables.<BR>	<BR>	4. Select the control ID representing the control associated with the new member	variable; in this case, <TT>IDC_EDIT_TEST</TT>.<BR>	<BR>	5. Click the button labeled Add Variable. An Add Member Variable dialog box appears.	Enter the control's name, category, and variable type, then click OK. For this example,	use the values from Table 6.2.</DL><H4><FONT COLOR="#000077">Table 6.2. Values used to add a CEdit member variable forCTestDlg.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>Control ID</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Variable Name</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Category</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Type</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_EDIT_TEST</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>m_editTest</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">Control</TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CEdit</TT></TD>	</TR></TABLE></P><P>The default value displayed in the Category control is <TT>Value</TT>. The <TT>Value</TT>category is used for some member variables later this hour, when you learn aboutDDV and DDX routines.<H2><FONT COLOR="#000077"><B>Collecting Entered Text from an Edit Control</B></FONT></H2><P>The primary reason for using an edit control, of course, is to collect informationfrom a user. To do that, you must get the information from the edit control. Usingthe <TT>CEdit</TT> class simplifies this process.<H3><FONT COLOR="#000077"><B>Using <TT>CEdit</TT> Member Functions to Retrieve Text</B></FONT></H3><P>Several <TT>CEdit</TT> member functions are useful when collecting informationfrom an edit control, such as the <TT>GetWindowText</TT> and <TT>LineLength</TT>member functions. As an example, add the source code in Listing 6.4 to the <TT>CTestDlg::OnTest</TT>member function, created earlier.<H4><FONT COLOR="#000077">TYPE: Listing 6.4. Collecting input from an edit controlusing CEdit.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CTestDlg::OnTest()</TT><TT>{</TT><TT>    CString szEdit;</TT><TT>    CString szResult;</TT><TT>    int nLength = m_editTest.LineLength();</TT><TT>    m_editTest.GetWindowText( szEdit );</TT><TT>    szResult.Format( &quot;%s has %d chars&quot;, szEdit, nLength );</TT><TT>    AfxMessageBox( szResult );</TT><TT>}</TT></FONT></PRE><P>When the Test button is clicked, the text entered in the edit control is retrievedby using the <TT>m_editTest</TT> object. Normally, you are interested only in datacontained in an edit control if OK is clicked. If the Cancel button is clicked, thedialog box should be closed and, usually, any entered information is simply discarded.<H2><FONT COLOR="#000077"><B>Passing Parameters to Dialog Boxes Using DDV and DDX

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线看| 天堂久久一区二区三区| 免费欧美在线视频| 99久久婷婷国产综合精品| 日韩一区二区三区av| 亚洲久草在线视频| 高清国产一区二区| 精品少妇一区二区三区 | 在线观看视频一区二区| 欧美激情在线一区二区三区| 奇米精品一区二区三区四区| 欧美在线免费观看亚洲| 国产精品高清亚洲| 国产精品亚洲专一区二区三区| 4438x成人网最大色成网站| 亚洲精品你懂的| www.在线成人| 国产精品五月天| 国产精品一区一区| 精品福利视频一区二区三区| 日本aⅴ免费视频一区二区三区| 欧美日韩一区二区在线视频| 玉米视频成人免费看| 91在线看国产| 国产精品久久久久久户外露出| 国产精品一区二区在线看| 亚洲精品在线电影| 国内国产精品久久| 精品免费国产二区三区| 免费人成精品欧美精品| 日韩一区二区在线看| 五月激情综合婷婷| 欧美猛男超大videosgay| 亚洲成在线观看| 欧美高清视频www夜色资源网| 亚洲r级在线视频| 欧美军同video69gay| 亚洲二区视频在线| 欧美日韩久久不卡| 午夜精品久久久久久久99樱桃| 欧美日韩视频一区二区| 亚洲国产日韩一级| 欧美亚洲综合色| 亚洲h精品动漫在线观看| 欧美色爱综合网| 视频在线观看一区二区三区| 欧美二区在线观看| 日韩和欧美一区二区三区| 91麻豆精品国产91久久久久久久久| 婷婷综合久久一区二区三区| 3atv一区二区三区| 狠狠色丁香九九婷婷综合五月| 精品成人a区在线观看| 国产一区 二区 三区一级| 欧美国产精品专区| 99久久久精品免费观看国产蜜| 亚洲男人都懂的| 欧美性猛交xxxx乱大交退制版| 亚洲a一区二区| 日韩精品一区二区三区swag| 国产麻豆午夜三级精品| 国产精品久久久久影院| 在线免费av一区| 日本大胆欧美人术艺术动态 | 91在线视频在线| 亚洲午夜激情网页| 日韩一区二区三区观看| 国产福利一区二区| 亚洲男女毛片无遮挡| 欧美日韩国产精品自在自线| 麻豆成人久久精品二区三区红| 国产天堂亚洲国产碰碰| 91伊人久久大香线蕉| 午夜影视日本亚洲欧洲精品| 日韩欧美高清一区| 99精品热视频| 日本不卡在线视频| 日本一区二区三区国色天香| 91女厕偷拍女厕偷拍高清| 日韩精品福利网| 国产亚洲成aⅴ人片在线观看| 91女人视频在线观看| 日韩激情视频网站| 国产精品五月天| 717成人午夜免费福利电影| 国产精品一区免费视频| 亚洲线精品一区二区三区八戒| 精品剧情在线观看| 91美女视频网站| 麻豆91在线播放免费| 国产精品久久久久9999吃药| 欧美丰满美乳xxx高潮www| 成人在线一区二区三区| 无吗不卡中文字幕| 亚洲国产精品99久久久久久久久 | 欧美偷拍一区二区| 国产一区二区调教| 亚洲第一狼人社区| 国产精品美女久久久久av爽李琼| 欧美日韩在线播| 成人精品小蝌蚪| 美国三级日本三级久久99 | 日韩精品一区二| 在线中文字幕一区| 国产精品12区| 日韩精品欧美成人高清一区二区| 最新成人av在线| 精品久久久影院| 91久久精品网| 粉嫩av一区二区三区| 免费精品视频在线| 亚洲综合视频在线观看| 中文字幕av一区二区三区免费看| 91精品欧美综合在线观看最新| 91在线视频网址| 国产成人精品影院| 麻豆国产精品777777在线| 亚洲一区欧美一区| 成人欧美一区二区三区白人| 久久精品亚洲精品国产欧美kt∨| 4438成人网| 欧美色大人视频| 91亚洲精品久久久蜜桃| 国产不卡视频在线播放| 久久99精品久久久久久| 天天色图综合网| 一区二区视频在线| 国产精品国产自产拍在线| 国产亚洲人成网站| 欧美电视剧在线观看完整版| 欧美日韩成人激情| 在线视频亚洲一区| 色综合天天综合给合国产| 国产a区久久久| 九色综合国产一区二区三区| 日本在线观看不卡视频| 亚洲午夜精品网| 亚洲最新视频在线播放| 亚洲视频一二三区| 国产精品美女久久久久aⅴ| 国产农村妇女毛片精品久久麻豆| 精品福利一二区| 欧美精品一区二区在线观看| 日韩欧美中文字幕制服| 777久久久精品| 欧美精品亚洲二区| 欧美男人的天堂一二区| 欧美日韩美少妇| 9191成人精品久久| 51久久夜色精品国产麻豆| 欧美精品乱人伦久久久久久| 欧美日韩国产高清一区| 欧美精品九九99久久| 欧美精品一二三区| 日韩一区二区三区免费观看| 日韩三级视频在线看| 日韩欧美不卡在线观看视频| 欧美电视剧免费全集观看| 欧美不卡一区二区三区四区| 欧美成人官网二区| 久久蜜桃av一区二区天堂| 欧美激情一区三区| 国产精品成人免费在线| 樱桃视频在线观看一区| 亚洲综合激情另类小说区| 亚洲成人tv网| 日本不卡一区二区| 精品亚洲成av人在线观看| 国产精品66部| av一区二区不卡| 欧美自拍偷拍一区| 911精品产国品一二三产区| 日韩免费观看高清完整版在线观看| 欧美mv日韩mv亚洲| 国产精品素人视频| 一区二区三区四区在线| 亚洲sss视频在线视频| 久久精品国产一区二区三区免费看| 国产综合色在线| 成人激情动漫在线观看| 91官网在线观看| 欧美一区二区三区精品| 久久久久久久久一| 亚洲天堂中文字幕| 午夜天堂影视香蕉久久| 久久99九九99精品| 成人免费视频网站在线观看| 91美女片黄在线观看| 欧美一区二区二区| 国产欧美日韩视频一区二区| 亚洲免费在线视频一区 二区| 视频在线观看一区二区三区| 国产精品亚洲一区二区三区在线| 色网综合在线观看| 日韩欧美亚洲一区二区| 国产精品久久三| 日本欧美在线观看| 成人的网站免费观看| 制服丝袜av成人在线看| 国产女同性恋一区二区|