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

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

?? ch23.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<H4><FONT COLOR="#000077">TYPE: Listing 23.1. Constructing a CMultiDocTemplate objectthat associates CDVTestDoc and CFormTest.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>CMultiDocTemplate* pDocTemplate;</TT><TT>pDocTemplate = new CMultiDocTemplate(</TT><TT>        IDR_DVTESTTYPE,</TT><TT>        RUNTIME_CLASS(CDVTestDoc),</TT><TT>        RUNTIME_CLASS(CChildFrame), // custom MDI child frame</TT><TT>        RUNTIME_CLASS(CFormTest));  // Change this line</TT></FONT></PRE><P><TT>AddDocTemplate(pDocTemplate);</TT> Because <TT>CFormTest</TT> is now used,the class declaration for <TT>CFormTest</TT> must be included into the <TT>DVTest.cpp</TT>source file. Add the following line after all other <TT>#include</TT> directivesat the top of the <TT>DVTest.cpp</TT> source file:</P><PRE><FONT COLOR="#0066FF"><TT>#include &quot;FormTest.h&quot;</TT></FONT></PRE><H3><FONT COLOR="#000077"><B>Handling Events and Messages in the Form View Class</B></FONT></H3><P>A form view must handle a wide variety of messages. Just like any view, it mustsupport several interfaces as part of the Document/View architecture. However, unlikeother views, a form view must also handle any controls contained by the view. Forexample, two events generated by controls must be handled in the <TT>CFormTest</TT>class:<UL>	<LI>When the button labeled Apply is pressed, the view should update the document	and prepare for a new entry.<BR>	<BR>		<LI>When the button labeled Close is pressed, the view should be closed.</UL><P>Use ClassWizard to add two message-handling functions for these events, usingthe values from Table 23.5.<H4><FONT COLOR="#000077">Table 23.5. Message-handling events added to the CFormTestclass.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>Object ID</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Message</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Function Name</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_APPLY</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>BN_CLICKED</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>OnApply</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_CLOSE</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>BN_CLICKED</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>OnClose</TT></TD>	</TR></TABLE></P><P>The code to handle control events is fairly straightforward. Edit the new functionsadded to the <TT>CFormTest</TT> class so that they look like the code in Listing23.2.<H4><FONT COLOR="#000077">TYPE: Listing 23.2. CFormTest functions used to handlecontrol messages.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CFormTest::OnApply()</TT><TT>{</TT><TT>    CDVTestDoc* pDoc;</TT><TT>    pDoc = (CDVTestDoc*)GetDocument();</TT><TT>    ASSERT_VALID( pDoc );</TT><TT>    CString szName;</TT><TT>    m_edNames.GetWindowText( szName );</TT><TT>    m_edNames.SetWindowText( &quot;&quot; );</TT><TT>    m_edNames.SetFocus();</TT><TT>    if( szName.GetLength() &gt; 0 )</TT><TT>    {</TT><TT>        int nIndex = pDoc-&gt;AddName( szName );</TT><TT>        m_lbNames.InsertString( nIndex, szName );</TT><TT>        m_lbNames.SetCurSel( nIndex );</TT><TT>    }</TT><TT>}</TT><TT>void CFormTest::OnClose()</TT><TT>{</TT><TT>    PostMessage( WM_COMMAND, ID_FILE_CLOSE );</TT></FONT></PRE><P><TT>}</TT> You must manually add an include statement for the document class.At the top of the <TT>FormView.cpp</TT> file, add the following line just after allthe other <TT>#include</TT> directives:</P><PRE><FONT COLOR="#0066FF"><TT>#include &quot;DVTestDoc.h&quot;</TT></FONT></PRE><P>The <TT>OnApply</TT> function is split into three main parts:<UL>	<LI>The document pointer is retrieved and verified, as in the <TT>OnDraw</TT> function	discussed in Hour 9.<BR>	<BR>		<LI>The contents of the edit control are collected and stored in a <TT>CString</TT>	object. After the string is collected, the control is cleared and the input focus	is returned to the edit control. This enables the user to immediately make a new	entry.<BR>	<BR>		<LI>If a string was entered, <TT>szName</TT> will have a length greater than zero.	If so, the name is added to the document and the list box is updated. The <TT>SetCurSel</TT>	function is used to scroll to the new list box item.</UL><P>The <TT>OnClose</TT> member function uses the <TT>PostMessage</TT> function tosend an <TT>ID_FILE_CLOSE</TT> message to the application. This has the same effectas selecting Close from the File menu.<H3><FONT COLOR="#000077"><B>Handling <TT>OnInitialUpdate</TT></B></FONT></H3><P>When using a form view, update it during <TT>OnInitialUpdate</TT>, as the viewis initially displayed. In Hour 9, <TT>CDVTestView</TT> used <TT>OnDraw</TT> to retrievethe document's contents and display the items in the view. The <TT>OnInitialUpdate</TT>function uses similar code, as shown in Listing 23.3. Before editing the code, addthe <TT>OnInitialUpdate</TT> function to the <TT>CFormTest</TT> class using ClassWizard.<H4><FONT COLOR="#000077">TYPE: Listing 23.3. Using OnInitialUpdate to retrieve datafrom the document.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CFormTest::OnInitialUpdate()</TT><TT>{</TT><TT>    CFormView::OnInitialUpdate();</TT><TT>    CDVTestDoc* pDoc = (CDVTestDoc*)GetDocument();</TT><TT>    ASSERT_VALID(pDoc);</TT><TT>    for( int nIndex = 0; nIndex &lt; pDoc-&gt;GetCount(); nIndex++ )</TT><TT>    {</TT><TT>        CString szName = pDoc-&gt;GetName( nIndex );</TT><TT>        m_lbNames.AddString( szName );</TT><TT>    }</TT><TT>}</TT></FONT></PRE><BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>When a dialog box	is displayed, the dialog resource is used to size the dialog box's window. A form	view is not automatically sized this way, which leads to an unexpected display if	you aren't aware of this behavior. However, you can resize the view to the exact	dimensions of the dialog resource by using the <TT>ResizeParentToFit</TT> function.	Add the following two lines of code to the <TT>CFormTest::OnInitialUpdate</TT> member	function:</P>	<PRE><FONT COLOR="#0066FF"><TT>ResizeParentToFit( FALSE );</TT><TT>ResizeParentToFit();</TT></FONT></PRE></BLOCKQUOTE><PRE><FONT COLOR="#0066FF"><TT></TT></FONT></PRE><BLOCKQUOTE>	<P>Nope, it's not a typo; you must call <TT>ResizeParentToFit</TT> twice to make	sure that the size is calculated correctly. The first call allows the view to expand	and the second call shrinks the view to fit the dialog resource. <HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>Preventing a View Class from Being Resized</B></FONT></H3><P>Like all views, you can resize a form view in three ways:<UL>	<LI>By dragging the view's frame with the mouse<BR>	<BR>		<LI>By pressing the minimize icon<BR>	<BR>		<LI>By pressing the maximize icon</UL><P>Although the minimize button is handy, the other sizing methods are a problemfor form views. Because a form view looks like a dialog box and the control layoutis specified in the dialog resource, preventing the user from resizing is a goodidea.</P><P>The form view class doesn't actually have any control over the minimize and maximizebuttons--they belong to the frame, which also controls the capability to change thesize of the view by dragging it with a mouse. The <TT>CChildFrame</TT> class is theframe used by default in MDI applications, although you can change the frame classby using a different class name when the document template is created.</P><P>To remove the sizable frame and minimize button from the frame class, add twolines of code to the frame class <TT>PreCreateWindow</TT> member function. The <TT>PreCreateWindow</TT>function is called just before the window is created. This enables you to changethe style of the window, as shown in Listing 23.4.<H4><FONT COLOR="#000077">TYPE: Listing 23.4. Using the PreCreateWindow functionto change CChildFrame style attributes.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>BOOL CChildFrame::PreCreateWindow(CREATESTRUCT&amp; cs)</TT><TT>{</TT><TT>    // Mask away the thickframe and maximize button style bits.</TT><TT>    cs.style &amp;= ~WS_THICKFRAME;</TT><TT>    cs.style &amp;= ~WS_MAXIMIZEBOX;</TT><TT>    return CMDIChildWnd::PreCreateWindow(cs);</TT></FONT></PRE><P><TT>}</TT> The <TT>&amp;=</TT> operator is the C++ bitwise <TT>AND</TT> operator,which is used to clear or remove a bit that is set in a particular value. The tilde(<TT>~</TT>) is the C++ inversion operator, used to &quot;flip&quot; the individualbits of a particular value. These two operators are commonly used together to maskoff attributes that have been set using the bitwise OR operator. In Listing 23.4,the <TT>WS_THICKFRAME</TT> and <TT>WS_MAXIMIZEBOX</TT> attributes are cleared fromthe <TT>cs.style</TT> variable.</P><P>Compile and run the DVTest project. Figure 23.4 shows DVTest after a few nameshave been added to the list box.</P><P><A NAME="04"></A><A HREF="04.htm"><B>Figure 23.4.</B></A> <I><BR>DVTest after adding a form view to the project.</I><H2><FONT COLOR="#000077"><B>Using Multiple Views</B></FONT></H2><P>Programs written for Windows sometimes offer multiple views for their data. Forexample, many word processors offer print preview and layout views of a document,in addition to the normal WYSIWYG view that's used most of the time. Providing multipleviews for a single document is a different issue than allowing several differentdocuments to be open at the same time; each view actually is connected to a singledocument, as shown in Figure 23.5.</P><P><A NAME="05"></A><A HREF="05.htm"><B>Figure 23.5.</B></A> <I><BR>Multiple views connected to a single document in an MDI application.</I></P><P>The most common reason to use multiple views is because there are different waysof looking at information contained in a document. For example, a form view oftenis used to give detailed information about a particular item in a database; anotherview might be used for data entry; still another type of view might be used to providea summary of all items in the same database. Offering several views at the same timeprovides maximum flexibility for users of the program.</P><P>Because each of these views is connected to a single document, there must be someway to update the views when needed to keep them synchronized. When one of the viewschanges the document, all views must immediately be updated.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>Using multiple	views allows each view to be specialized for a particular purpose. If only a single	view were allowed, that view would have to be extremely flexible to suit the needs	of every user of your program. Creating specialized views for particular purposes	allows each of these views to do a single job for which they are well suited. <HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>How to Use Multiple Views</B></FONT></H3><P>Using multiple views in an MDI application is easy because the Document/View architecturekeeps the document and view classes separate from each other. The document classis mainly passive; it notifies the framework when views should be updated, but otherwiserelies on the view classes to change or request data stored in the document.</P><P>A new view is easily associated with an existing document. After a document classhas been modified to work with multiple views, any number of view classes can beadded to the program without further modifications to the document class. The followingsteps are required to modify an MDI program to use multiple views:<UL>	<LI>Create a new view class in addition to any existing view associated with the	document.<BR>	<BR>		<LI>Create shared resources, if needed, for the new view class.<BR>	<BR>		<LI>Add code to the view classes to properly handle the <TT>OnInitialUpdate</TT>	and <TT>OnUpdate</TT> virtual functions.<BR>	<BR>		<LI>Modify the document class to call <TT>UpdateAllViews</TT> when the data contained	in the document changes.<BR>	<BR>		<LI>Modify the application class so that it stores pointers to document templates	it creates.<BR>	<BR>		<LI>Add code to the main frame class to handle menu selections that select a particular	view.</UL><P>You will learn about each of these steps in the following sections. Because theDocument/View architecture is designed to support multiple views, you can rely onClassWizard to write much of the code for you. To reduce the amount of typing needed,continue to modify the DVTest program from Hour 9.<H3><FONT COLOR="#000077"><B>Creating a New View</B></FONT></H3><P>The first step in adding a new view to an existing document is to define the viewby creating a view class. Any type of view can be added to an existing MDI program.In this set of examples, the new view displays the names contained in the documentclass. The existing form view is used to add names to the <TT>DVTestDoc</TT> document.</P><P>The new view class, <TT>CDisplayView</TT>, is derived directly from <TT>CView</TT>.Because <TT>CDisplayView</TT> only displays information, it must support only two

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩亚洲欧美在线观看| 亚洲综合色噜噜狠狠| 亚洲欧美偷拍卡通变态| 免费日韩伦理电影| 91在线观看地址| 精品国产乱码久久久久久浪潮 | 国产精品一区二区在线观看网站 | 国产精品久久久久毛片软件| 亚洲成人资源在线| 成人avav在线| 久久精品人人爽人人爽| 天天av天天翘天天综合网| heyzo一本久久综合| 精品久久久久香蕉网| 亚洲午夜视频在线| 色哟哟国产精品| 国产精品三级av| 国产经典欧美精品| 精品三级在线观看| 日产欧产美韩系列久久99| 欧美日精品一区视频| 亚洲免费大片在线观看| 国产不卡视频一区| 精品国产第一区二区三区观看体验| 亚洲日本va午夜在线电影| 国产成人av网站| 久久久www成人免费无遮挡大片| 日本aⅴ免费视频一区二区三区| 91九色02白丝porn| 亚洲欧洲精品一区二区精品久久久| 国产精品一区二区男女羞羞无遮挡| 日韩欧美在线综合网| 天堂va蜜桃一区二区三区 | 亚洲免费观看高清完整版在线观看熊| 国产一区二区毛片| 日本一区二区免费在线 | 精品综合免费视频观看| 欧美一区日本一区韩国一区| 午夜精品福利一区二区三区蜜桃| 欧美系列日韩一区| 亚洲一区二区三区视频在线播放 | 午夜欧美大尺度福利影院在线看 | 久久精品网站免费观看| 激情文学综合丁香| 国产调教视频一区| 成人高清免费观看| 亚洲欧美偷拍三级| 日韩女优av电影| 美女视频黄免费的久久| 日韩午夜在线观看视频| 国内精品伊人久久久久av一坑| 久久夜色精品国产噜噜av| 国产大片一区二区| 亚洲天堂中文字幕| 7799精品视频| 国产一区二区三区四区在线观看| 亚洲国产精品精华液ab| 色综合天天做天天爱| 亚洲一二三级电影| 精品免费国产二区三区| www.欧美.com| 午夜久久久久久久久| 精品国产麻豆免费人成网站| 成人激情免费网站| 一区二区三区四区视频精品免费 | 久久先锋影音av鲁色资源网| 成人小视频免费在线观看| 亚洲精品成人天堂一二三| 欧美一区二区成人| 成人av电影在线观看| 婷婷久久综合九色综合绿巨人| 欧美tk—视频vk| 99久久精品国产毛片| 视频在线观看一区| 亚洲国产成人私人影院tom| 欧美视频在线一区二区三区| 狠狠色狠狠色综合日日91app| 中文字幕亚洲一区二区av在线| 欧美喷潮久久久xxxxx| 国产精品一区二区在线播放| 亚洲图片欧美色图| 国产情人综合久久777777| 欧美在线观看视频一区二区| 国产专区欧美精品| 午夜电影一区二区三区| 欧美国产1区2区| 91精品国产一区二区人妖| 99在线精品视频| 狠狠色狠狠色综合系列| 亚洲成av人综合在线观看| 国产精品青草久久| 欧美一区二区三区在线视频| 91丨porny丨蝌蚪视频| 国产一区在线不卡| 午夜天堂影视香蕉久久| 日本一区二区成人| 久久天天做天天爱综合色| 欧美性生交片4| 不卡视频免费播放| 国产在线精品一区二区不卡了| 丝袜亚洲另类丝袜在线| 一区二区三区四区精品在线视频| 久久亚洲综合色| 日韩西西人体444www| 欧美日韩国产片| 91丨porny丨在线| 成人aaaa免费全部观看| 狠狠色综合色综合网络| 美国三级日本三级久久99 | 精品在线播放午夜| 天天亚洲美女在线视频| 亚洲国产综合人成综合网站| 亚洲老司机在线| 亚洲三级在线免费观看| 成人免费小视频| 中文字幕一区av| 亚洲欧美综合另类在线卡通| 国产精品丝袜一区| 中文子幕无线码一区tr| 国产精品免费视频观看| 国产欧美一区二区三区鸳鸯浴 | 丁香五精品蜜臀久久久久99网站| 国内久久婷婷综合| 中文字幕一区在线观看| 国产精品久久久久久妇女6080 | 日韩国产一二三区| 视频一区视频二区在线观看| 婷婷成人综合网| 日韩高清国产一区在线| 久久精品国产成人一区二区三区 | 在线观看视频91| 91麻豆蜜桃一区二区三区| 91黄视频在线观看| 欧美在线观看视频在线| 这里只有精品免费| 精品国产91九色蝌蚪| 亚洲国产岛国毛片在线| 亚洲猫色日本管| 亚洲不卡一区二区三区| 免费成人性网站| 精品亚洲成av人在线观看| 东方欧美亚洲色图在线| 色8久久精品久久久久久蜜| 欧美日韩国产片| 久久综合色播五月| 国产精品久久精品日日| 亚洲午夜免费福利视频| 狠狠色丁香婷婷综合久久片| 国产传媒日韩欧美成人| 91精品1区2区| 精品欧美乱码久久久久久1区2区| 国产三级久久久| 亚洲一区二区三区四区五区黄| 极品少妇xxxx精品少妇偷拍| 成人动漫一区二区| 欧美三级在线视频| 欧美成人a∨高清免费观看| 中文字幕亚洲一区二区va在线| 亚洲福利视频一区二区| 国产精品资源在线看| 欧美日韩在线观看一区二区| 亚洲精品一区二区三区影院| 一区二区三区日韩欧美| 国产资源在线一区| 欧美三级电影精品| 日本一区二区成人在线| 日韩精品1区2区3区| 成人av在线网站| 欧美一区二区女人| 亚洲欧美另类图片小说| 久久99精品一区二区三区| 99v久久综合狠狠综合久久| 正在播放一区二区| 亚洲精品国产第一综合99久久 | 久久久91精品国产一区二区三区| 一区二区中文字幕在线| 久久99精品久久久久久| 精品视频999| 樱桃国产成人精品视频| 国产99久久久久| 欧美一区二区久久久| 亚洲一二三四在线观看| 成人av在线资源网| 国产亚洲婷婷免费| 黑人精品欧美一区二区蜜桃| 欧美一区二区三区精品| 亚洲一区二区三区免费视频| 99国产精品久| 国产精品高清亚洲| 国产**成人网毛片九色| 国产亚洲综合色| 国产一区不卡精品| 精品电影一区二区三区| 捆绑调教美女网站视频一区| 7777精品伊人久久久大香线蕉| 亚洲一区成人在线| 91成人网在线| 亚洲国产日韩一级| 欧美日韩一区二区三区不卡| 亚洲免费在线播放|