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

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

?? ch23.htm

?? 24小時(shí)精通VC
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>ID_WINDOW_FORM</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">&amp;Form View</TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>COMMAND</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>OnWindowForm</TT></TD>	</TR></TABLE><BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>CAUTION:</B></FONT><B> </B>You must add the new	menu items to both the <TT>IDR_DISPLAYTYPE</TT> and <TT>IDR_DVTESTTYPE</TT> menus.	If you don't, you won't be able to access the new menu items when either view is	active. <HR></BLOCKQUOTE><P>Listing 23.9 provides the source code for the message-handling functions.<H4><FONT COLOR="#000077">TYPE: Listing 23.9. CMainFrame member functions used tocreate new views.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CMainFrame::OnWindowForm()</TT><TT>{</TT><TT>    CMDIChildWnd* pActiveChild = MDIGetActive();</TT><TT>    if( pActiveChild != 0 )</TT><TT>    {</TT><TT>        CDocument*  pDocument = pActiveChild-&gt;GetActiveDocument();</TT><TT>        if( pDocument != 0 )</TT><TT>        {</TT><TT>            CDVTestApp*     pApp = (CDVTestApp*)AfxGetApp();</TT><TT>            CDocTemplate*   pTemp;</TT><TT>            CFrameWnd*      pFrame;</TT><TT>            pTemp = pApp-&gt;GetFormTemplate();</TT><TT>            pFrame = pTemp-&gt;CreateNewFrame(pDocument,pActiveChild);</TT><TT>            if( pFrame != 0 )</TT><TT>            {</TT><TT>                pTemp-&gt;InitialUpdateFrame(pFrame, pDocument);</TT><TT>            }</TT><TT>        }</TT><TT>    }</TT><TT>}</TT><TT>void CMainFrame::OnWindowDisplay()</TT><TT>{</TT><TT>    CMDIChildWnd* pActiveChild = MDIGetActive();</TT><TT>    if( pActiveChild != 0 )</TT><TT>    {</TT><TT>        CDocument*  pDocument = pActiveChild-&gt;GetActiveDocument();</TT><TT>        if( pDocument != 0 )</TT><TT>        {</TT><TT>            CDVTestApp*     pApp = (CDVTestApp*)AfxGetApp();</TT><TT>            CDocTemplate*   pTemp;</TT><TT>            CFrameWnd*      pFrame;</TT><TT>            pTemp = pApp-&gt;GetDisplayTemplate();</TT><TT>            pFrame = pTemp-&gt;CreateNewFrame(pDocument,pActiveChild);</TT><TT>            if( pFrame != 0 )</TT><TT>            {</TT><TT>                pTemp-&gt;InitialUpdateFrame(pFrame, pDocument);</TT><TT>            }</TT><TT>        }</TT><TT>    }</TT></FONT></PRE><P><TT>}</TT> These functions are nearly identical: the only difference between themis the call to either <TT>GetDisplayTemplate</TT> or <TT>GetFormTemplate</TT>. Thefunctions provided in Listing 23.9 follow these steps when creating a new view:<DL>	<DD>1. Get a pointer to the active child window.<BR>	<BR>	2. Get a pointer to the active document.<BR>	<BR>	3. Get a pointer to the application.<BR>	<BR>	4. Using the application pointer, get the document template for the new view.<BR>	<BR>	5. Using the document template, create a new frame associated with the active frame	from step 1 and the document pointer from step 2.<BR>	<BR>	6. Update the frame.</DL><P>These basic steps can be followed no matter what classes are involved or how manyviews and documents are being managed by the application.<H3><FONT COLOR="#000077"><B>Updating Multiple Views</B></FONT></H3><P>One of the most important issues when a document has more than one view is ensuringthat each view is accurate. If one view changes data loaded in the document, allviews must be notified about the change; otherwise, they will present out-of-dateinformation. The mechanism used by Document/View applications to keep documents andviews synchronized is shown in Figure 23.6.</P><P><A NAME="06"></A><A HREF="06.htm"><B>Figure 23.6.</B></A> <BR><I>The document class controls the updating of all views.</I></P><P>Every document should provide updates to its associated views by calling the <TT>UpdateAllViews</TT>function when data contained by the document has been changed. To update all viewsassociated with a document, you can use a line like this:</P><PRE><FONT COLOR="#0066FF"><TT>UpdateAllViews( NULL );</TT></FONT></PRE><P>The default implementation of <TT>UpdateAllViews</TT> notifies every view thatthe document has been changed by calling each view object's <TT>OnUpdate</TT> memberfunction. The <TT>NULL</TT> parameter causes all views to be updated. If a view pointeris passed as a parameter, that view is not updated. Listing 23.10 provides the newsource code for the <TT>CDVTestDoc::AddName</TT> function.<H4><FONT COLOR="#000077">TYPE: Listing 23.10. A new version of CDVTestDoc::AddNamethat causes views to be updated.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>int CDVTestDoc::AddName( const CString&amp; szName )</TT><TT>{</TT><TT>    TRACE(&quot;CDVTestDoc::AddName, string = %s\n&quot;, (LPCSTR)szName);</TT><TT>    int nPosition = m_arNames.Add( szName );</TT><TT>    UpdateAllViews( NULL );</TT><TT>    return nPosition;</TT><TT>}</TT></FONT></PRE><H3><FONT COLOR="#000077"><B>Adding the <TT>OnInitialUpdate</TT> and <TT>OnUpdate</TT>Member Functions</B></FONT></H3><P>The <TT>OnInitialUpdate</TT> and <TT>OnUpdate</TT> member functions for <TT>CDisplayView</TT>invalidate the view area, causing the view to be repainted. When Windows sends a<TT>WM_PAINT</TT> message to the view, the <TT>OnDraw</TT> member function is called,redrawing the view with the new contents. Edit the <TT>OnInitialUpdate</TT> and <TT>OnUpdate</TT>functions as shown in Listing 23.11.<H4><FONT COLOR="#000077">TYPE: Listing 23.11. Source code the CDisplayView updatefunctions.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CDisplayView::OnInitialUpdate()</TT><TT>{</TT><TT>    CView::OnInitialUpdate();</TT><TT>    InvalidateRect( NULL );</TT><TT>}</TT><TT>void CDisplayView::OnUpdate(CView* pSender, LPARAM lHint,</TT><TT>                            CObject* pHint)</TT><TT>{</TT><TT>    InvalidateRect( NULL );</TT><TT>}</TT> </FONT></PRE><P>All view classes should provide <TT>OnUpdate</TT> member functions that are calledby the MFC framework after the document class calls <TT>UpdateAllViews</TT>. Notethat the entire view is redrawn whenever the document has been updated.</P><P>The current view, <TT>CFormTest</TT>, must also support <TT>OnUpdate</TT>. Addthe <TT>OnUpdate</TT> function to the <TT>CFormTest</TT> class using ClassWizard.Listing 23.12 provides the source code for <TT>CFormTest::OnUpdate</TT>.<H4><FONT COLOR="#000077">TYPE: Listing 23.12. Source code for the CFormTest::OnUpdatefunction.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CFormTest::OnUpdate(CView* pSender, LPARAM lHint,</TT><TT>                         CObject* pHint)</TT><TT>{</TT><TT>    CDVTestDoc* pDoc = (CDVTestDoc*)GetDocument();</TT><TT>    ASSERT_VALID(pDoc);</TT><TT>    m_lbNames.ResetContent();</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><P>Now that you have implemented <TT>OnUpdate</TT>, change the <TT>OnInitialUpdate</TT>member function so that it performs only work that must be done when the view isinitially displayed. Remove source code from <TT>CFormTest::OnInitialUpdate</TT>so it looks like the function provided in Listing 23.13.<H4><FONT COLOR="#000077">TYPE: Listing 23.13. CFormTest::OnInitialUpdate after removingunnecessary code.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CFormTest::OnInitialUpdate()</TT><TT>{</TT><TT>    CFormView::OnInitialUpdate();</TT><TT>    ResizeParentToFit( FALSE );</TT><TT>    ResizeParentToFit();</TT><TT>}</TT> </FONT></PRE><P>Because <TT>OnUpdate</TT> handles the insertion of new items into the list box,you should change the <TT>OnApply</TT> member function so that it does not add stringsto the list box. Edit the <TT>OnApply</TT> member function so it looks like the codein Listing 23.14.<H4><FONT COLOR="#000077">TYPE: Listing 23.14. CFormTest::OnApply after removinglist box AddString code.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CFormTest::OnApply()</TT><TT>{</TT><TT>    CDVTestDoc* 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>        pDoc-&gt;AddName( szName );</TT><TT>    }</TT><TT>}</TT> </FONT></PRE><P>Compile and run the DVTest project. Figure 23.7 shows DVTest with new names addedto the document, and multiple open views.</P><P><A NAME="07"></A><A HREF="07.htm"><B>Figure 23.7.</B></A> <I><BR>DVTest after adding the display view.</I><H2><FONT COLOR="#000077"><B>Summary</B></FONT></H2><P>In this hour you learned about using form views in place of standard views ordialog boxes. Form views enable you to easily use controls in a view, just as theyare used in dialog boxes. You also learned about associating multiple views witha document class. The DVTest program from Hour 9 was modified to take advantage ofform views and multiple views.<H2><FONT COLOR="#000077"><B>Q&amp;A</B></FONT></H2><DL>	<DD><B>Q I have a view that must populate the menu with different menu items than	other views. How should I handle the different menu choices?</B><BR>	<BR>	<B>A</B> There is no requirement that all view menus have the same items; each view	menu can be customized to suit the needs of each view. You should give each menu	item a unique identifier--two menu items that perform different tasks should have	different identifiers, even if they have the same names.<BR>	<BR>	<B>Q Why is it useful to pass a <TT>CView</TT> pointer as a parameter in <TT>UpdateAllViews</TT>	and prevent that view from receiving an <TT>OnUpdate</TT> notification?</B><BR>	<BR>	<B>A</B> Often, a view that causes a document to be updated can efficiently update	its own view. In this case, there is no need for that particular view to be updated.</DL><H2><FONT COLOR="#000077"><B>Workshop</B></FONT></H2><P>The Workshop is designed to help you anticipate possible questions, review whatyou've learned, and begin thinking ahead to putting your knowledge into practice.The answers to the quiz are in Appendix B, &quot;Quiz Answers.&quot;<H3><FONT COLOR="#000077"><B>Quiz</B></FONT></H3><DL>	<DD>1. What are some differences between a form view and a dialog box?<BR>	<BR>	2. What are the special requirements for dialog box resources used in a form view?<BR>	<BR>	3. How do you size the frame of a form view so that it is the same size as its dialog	box resource?<BR>	<BR>	4. What is the difference between <TT>OnInitialUpdate</TT> and <TT>OnUpdate</TT>?<BR>	<BR>	5. How do you prevent an MDI child window from being resized?<BR>	<BR>	6. What function is called by a document class to notify views that the document	has been changed?<BR>	<BR>	7. What resources are identified through a shared resource identifier?<BR>	<BR>	8. What view class enables you to use an edit control as a view?<BR>	<BR>	9. What view class enables your view to have a large virtual area that is seen through	a smaller scrolling viewport?<BR>	<BR>	10. What class is used in an MDI application to associate a view class and a document	class?</DL><H3><FONT COLOR="#000077"><B>Exercises</B></FONT></H3><DL>	<DD>1. Because the <TT>CChildFrame</TT> class was modified to prevent resizing, the	instances of the <TT>CDisplayView</TT> class cannot be resized. Modify DVTest so	that display views can be resized and form views cannot be resized.<BR>	<BR>	2. Modify the form view in DVTest so that it displays the number of items stored	in the document.<FONT COLOR="#000077"></FONT></DL><CENTER><P><HR><A HREF="../ch22/ch22.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch24/ch24.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> <BR><BR><BR><IMG SRC="../button/corp.gif" WIDTH="284" HEIGHT="45" ALIGN="BOTTOM" ALT="Macmillan Computer Publishing USA"BORDER="0"></P><P>&copy; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. Allrights reserved.</CENTER></BODY></HTML>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
老鸭窝一区二区久久精品| 国产欧美日韩不卡免费| 一区二区三区中文字幕精品精品| 另类综合日韩欧美亚洲| 日韩欧美黄色影院| 国产最新精品免费| 日本一区二区成人在线| 成人黄色777网| 夜色激情一区二区| 欧美日韩精品系列| 蜜桃av噜噜一区| 精品99999| 99精品欧美一区二区蜜桃免费 | 91在线丨porny丨国产| 亚洲天堂中文字幕| 精品视频1区2区| 麻豆传媒一区二区三区| 国产精品无码永久免费888| 99re免费视频精品全部| 视频一区在线播放| 26uuu精品一区二区三区四区在线| 国产伦精一区二区三区| 国产精品免费看片| 欧美日本国产视频| 成人丝袜18视频在线观看| 亚洲日本电影在线| 精品久久久久香蕉网| 色综合久久天天| 国产精品91xxx| 亚洲aⅴ怡春院| 成人免费在线视频| 久久嫩草精品久久久精品| 在线视频一区二区三| 久久精品国产99久久6| 专区另类欧美日韩| 国产午夜精品福利| 欧美tk丨vk视频| 欧美日本乱大交xxxxx| 91丝袜呻吟高潮美腿白嫩在线观看| 国产精品视频免费| 精品国产露脸精彩对白| 欧美日本韩国一区| 在线精品视频一区二区三四 | 天天色综合天天| 一区二区三区在线免费视频| 亚洲国产精品av| 亚洲国产高清不卡| 欧美激情一区二区在线| 久久综合九色综合97婷婷| 日韩精品一区二区三区蜜臀| 欧美日韩一区二区电影| 欧美日韩国产小视频| 欧美日韩综合不卡| 欧美电影在线免费观看| 91精品国产综合久久久久久漫画| 91在线免费看| 欧美日韩视频一区二区| 欧美一区二区三区四区久久| 日韩欧美久久久| 久久亚洲一区二区三区明星换脸| 精品国产免费人成电影在线观看四季| 56国语精品自产拍在线观看| 日韩三级.com| 国产精品色眯眯| 亚洲国产成人tv| 国内外精品视频| 99国产精品久久久久久久久久久 | 国产三级一区二区三区| 欧美激情一区二区三区全黄| 亚洲三级在线免费| 日韩高清在线一区| 高清不卡一二三区| 欧美日韩不卡一区| 国产精品久久久久久久岛一牛影视 | 中文字幕欧美一| 蜜臀a∨国产成人精品| 国产成人激情av| 欧美一级片在线看| 1024精品合集| 成人综合婷婷国产精品久久蜜臀| 色激情天天射综合网| 久久一区二区三区四区| 亚洲一区日韩精品中文字幕| 国产69精品久久99不卡| 欧美日韩美少妇 | 日韩精品一区二区在线| 尤物在线观看一区| 91视频精品在这里| 国产人成亚洲第一网站在线播放| 日韩av在线免费观看不卡| 99re成人精品视频| 中文字幕亚洲精品在线观看| 国产精品18久久久| 日本一区二区三区国色天香| 紧缚奴在线一区二区三区| 日韩欧美精品三级| 日本一不卡视频| 欧美一区二区三区视频| 日本不卡不码高清免费观看| 欧美日韩在线播放| 亚洲成在人线在线播放| 欧美调教femdomvk| 亚洲欧美国产三级| 欧美色图片你懂的| 免费av网站大全久久| 精品国产制服丝袜高跟| 国产一区二区三区电影在线观看| 欧美成人一区二区| 处破女av一区二区| 亚洲精品成人少妇| 欧美一区二区女人| 不卡视频免费播放| 久久精品国产精品亚洲精品| 精品国产免费一区二区三区四区 | 国产精品久久久爽爽爽麻豆色哟哟| 国产成人av电影在线| 亚洲影院免费观看| 欧美不卡一区二区| 色呦呦一区二区三区| 青草国产精品久久久久久| 26uuu亚洲综合色欧美 | 国产suv一区二区三区88区| 亚洲精品成a人| 久久久精品蜜桃| 在线播放欧美女士性生活| 国产一区 二区| 免费成人在线视频观看| 国产精品嫩草99a| 精品国产免费人成在线观看| 欧美体内she精高潮| 成人av网站在线观看| 精品午夜一区二区三区在线观看| 亚洲成在人线在线播放| 国产精品欧美一级免费| 欧美tk—视频vk| 欧美一级高清大全免费观看| 99久久国产综合色|国产精品| 久久综合综合久久综合| 亚洲成人黄色小说| 亚洲成人av中文| 国产精品国产三级国产| 亚洲制服丝袜一区| 国产日产精品一区| 久久久久九九视频| 欧美日韩成人综合天天影院| 日本精品视频一区二区| 99这里只有久久精品视频| 菠萝蜜视频在线观看一区| k8久久久一区二区三区| aaa亚洲精品| 91高清在线观看| 欧美性淫爽ww久久久久无| 欧美日韩一区不卡| 欧美人与z0zoxxxx视频| 欧美成人video| 国产精品欧美极品| 亚洲制服丝袜av| 亚洲国产精品尤物yw在线观看| 亚洲午夜在线电影| 精品一区二区三区影院在线午夜| 日韩精品亚洲专区| 国产成人夜色高潮福利影视| www.色综合.com| 欧美欧美午夜aⅴ在线观看| 日韩三级在线免费观看| 国产精品久久久久影院亚瑟| 亚洲亚洲精品在线观看| 国产乱人伦偷精品视频不卡| 日本韩国欧美一区二区三区| 欧美精品v国产精品v日韩精品| 日韩欧美亚洲国产另类| 中文字幕中文字幕中文字幕亚洲无线 | 波多野结衣亚洲| 日韩一区二区三免费高清| 亚洲欧美在线高清| 久久99精品久久久久婷婷| 欧美专区日韩专区| 日本一区二区电影| 久久国产三级精品| 欧美日韩国产一级片| 国产精品成人免费精品自在线观看| 麻豆国产精品视频| 欧美老年两性高潮| 亚洲国产中文字幕| 色婷婷国产精品久久包臀 | 日韩视频中午一区| 亚洲电影在线免费观看| 欧美无乱码久久久免费午夜一区| 国产精品免费视频观看| 风流少妇一区二区| 久久久久久久久久久久电影| 久久激五月天综合精品| 欧美精品乱码久久久久久按摩| 亚洲一区二区成人在线观看| 日本精品一级二级| 亚洲免费观看在线观看| 在线观看91视频| 丝袜国产日韩另类美女| 欧美高清视频www夜色资源网| 日本欧美一区二区在线观看|