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

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

?? ch08.htm

?? 一天之內學會VC#. 主要介紹VC#的各種應用和示例
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
	of messages sent to the <TT>CMouseTstView</TT> class will be displayed in the Message
	list box.<BR>
	<BR>
	2. Select the <TT>WM_LBUTTONDOWN</TT> message from the Message list box, and click
	the Add Function button.<BR>
	<BR>
	3. Repeat step 2 for the <TT>WM_RBUTTONDOWN</TT>, <TT>WM_LBUTTONDBLCLK</TT>, and
	<TT>WM_RBUTTONDBLCLK</TT> messages.<BR>
	<BR>
	4. Click OK to close ClassWizard.
</DL>

<P>Edit the message-handling functions so they look like the function provided in
Listing 8.5. You must remove some source code provided by ClassWizard in each function.
<H4><FONT COLOR="#000077">TYPE: Listing 8.5. The four mouse-handling functions for
CMouseTstView.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CMouseTstView::OnLButtonDblClk(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Left Button Double Click&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
<TT>}</TT>

<TT>void CMouseTstView::OnLButtonDown(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Left Button Down&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
<TT>}</TT>

<TT>void CMouseTstView::OnRButtonDblClk(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Right Button Double Click&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
<TT>}</TT>

<TT>void CMouseTstView::OnRButtonDown(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Right Button Down&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
</FONT></PRE>
<P><TT>}</TT> Each of the message-handling functions in Listing 8.5 stores the position
of both the mouse event and a text string that describes the event. Each function
then invalidates the view rectangle. The next step is to use the <TT>CMouseTstView::OnDraw</TT>
function to display the event. Edit <TT>CMouseTstView::OnDraw</TT> so it contains
the source code in Listing 8.6. Remove any existing source code provided by AppWizard.
<H4><FONT COLOR="#000077">TYPE: Listing 8.6. The OnDraw member function for CMouseTstView.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CMouseTstView::OnDraw(CDC* pDC)</TT>
<TT>{</TT>
<TT>    pDC-&gt;TextOut( m_ptMouse.x, m_ptMouse.y, m_szDescription );</TT>
</FONT></PRE>
<P><TT>}</TT> The <TT>OnDraw</TT> member function uses <TT>TextOut</TT> to display
the previously saved event message. The <TT>CPoint</TT> object, <TT>m_ptMouse</TT>,
was used to store the mouse event's position. A <TT>CPoint</TT> object has two member
variables, <TT>x</TT> and <TT>y</TT>, which are used to plot a point in a window.
<H3><FONT COLOR="#000077"><B>Running MouseTst</B></FONT></H3>
<P>Build and run MouseTst, then click the main window's client area. A message is
displayed whenever you click the left or right mouse button.</P>
<P>Figure 8.4 shows the MouseTst program after a mouse button has been clicked.</P>
<P><A NAME="04"></A><A HREF="04.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch08/04.htm"><B>Figure 8.4.</B></A> <I><BR>
The MouseTst program displaying a mouse event.</I>
<H2><FONT COLOR="#000077"><B>What Are MFC Base Classes?</B></FONT></H2>
<P>The MFC class library includes a large number of classes well suited for Windows
programming. Most of these classes are derived from <TT>CObject</TT>, a class that
is at the root of the MFC class hierarchy. In addition, any class that represents
a window or control is derived from the <TT>CWnd</TT> class, which handles basic
functions that are common to all windows.


<BLOCKQUOTE>
	<P>
<HR>
<B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>The <TT>CObject</TT>
	and <TT>CWnd</TT> classes use virtual functions, which enable your program to access
	general-purpose functions through a base pointer. This enables you to easily use
	any object that is derived from <TT>CObject</TT> or <TT>CWnd</TT> when interacting
	with the MFC framework. 
<HR>


</BLOCKQUOTE>

<H3><FONT COLOR="#000077"><B>The <TT>CObject</TT> Base Class</B></FONT></H3>
<P>Almost every class used in an MFC program is derived from <TT>CObject</TT>. The
<TT>CObject</TT> class provides four types of services:

<UL>
	<LI>Diagnostic memory management provides diagnostic messages when memory leaks are
	detected. These leaks are often caused by failing to free objects that have been
	dynamically created.<BR>
	<BR>
	
	<LI>Dynamic creation support uses the <TT>CRuntimeClass</TT> to enable objects to
	be created at runtime. This is different from creating objects dynamically using
	the <TT>new</TT> operator.<BR>
	<BR>
	
	<LI>Serialization support enables an object to be stored and loaded in an object-oriented
	fashion. Serialization is discussed in Hour 22, &quot;Serialization.&quot;<BR>
	<BR>
	
	<LI>Runtime class information is used by the MFC class library to provide diagnostic
	information when errors are discovered in your program. Runtime class information
	is also used when you're serializing objects to or from storage.
</UL>

<H3><FONT COLOR="#000077"><B>The <TT>CWnd</TT> Base Class</B></FONT></H3>
<P>The <TT>CWnd</TT> class is derived from <TT>CObject</TT> and adds a great deal
of functionality that is shared by all windows in an MFC program. This also includes
dialog boxes and controls, which are just specialized versions of windows. Figure
8.5 shows some of the major MFC classes derived from <TT>CWnd</TT>.</P>
<P><A NAME="05"></A><A HREF="05.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch08/05.htm"><B>Figure 8.5.</B> </A><I><BR>
Some of the major MFC classes derived from <TT>CWnd</TT>.</I></P>
<P>The <TT>CWnd</TT> class defines functions that can be applied to any <TT>CWnd</TT>
object, including objects that are instances of classes derived from <TT>CWnd</TT>.
As first shown in Hour 5, &quot;Button Controls,&quot; to set the caption or title
for any window, including controls, you can use the <TT>CWnd::SetWindowText</TT>
function.</P>
<P>Almost every significant object in an MFC program is a <TT>CObject</TT> instance.
This enables you to take advantage of the MFC support for discovering many common
memory leaks and other types of programming errors. The <TT>CObject</TT> class also
declares functions that can be used to provide diagnostic dumps during runtime and
support for serialization. Serialization is discussed in Hour 22.</P>
<P>Every window in an MFC program is a <TT>CWnd</TT> object. <TT>CWnd</TT> is derived
from <TT>CObject</TT> so it has all the <TT>CObject</TT> functionality built in.
Using the <TT>CWnd</TT> class to handle all controls and windows in your program
enables you to take advantage of polymorphism; the <TT>CWnd</TT> class provides all
the general window functions for all types of windows. This means you don't need
to know exactly what type of control or window is accessed through a <TT>CWnd</TT>
pointer in many cases.
<H3><FONT COLOR="#000077"><B>An Example Using the <TT>CObject</TT> and <TT>CWnd</TT>
Base Classes</B></FONT></H3>
<P>The <TT>CObject</TT> and <TT>CWnd</TT> classes are used in different ways. The
<TT>CObject</TT> class is normally used as a base class when you create your own
classes. The <TT>CWnd</TT> class is often passed as a function parameter or return
value and is used as a generic pointer to any type of window in an MFC program.</P>
<P>In this section, you create a sample console mode project that demonstrates how
the <TT>CObject</TT> class is used. To start the sample, create a new console mode
project named Runtime. In addition, configure the project so that it uses the MFC
class library by following these steps:

<DL>
	<DD>1. Select Settings from the Project menu. This opens the Project Settings dialog
	box.<BR>
	<BR>
	2. Click the General tab.<BR>
	<BR>
	3. Select Use MFC in a Shared DLL from the Microsoft Foundation Classes combo box.<BR>
	<BR>
	4. Close the dialog box by clicking OK.
</DL>

<H4><FONT COLOR="#000077">Using CObject as a Base Class</FONT></H4>
<P>The <TT>CObject</TT> class is always used as a base class; there isn't really
anything that can be done with a plain <TT>CObject</TT>. When used as a base class,
the <TT>CObject</TT> class provides a great deal of basic functionality to a class.
You can control the amount of functionality provided by <TT>CObject</TT> by using
macros in the derived class's declaration and definition files.</P>
<P>Four different levels of support are offered by <TT>CObject</TT> to its derived
classes:

<UL>
	<LI>Basic support with memory leak detection requires no macros.<BR>
	<BR>
	
	<LI>Support for runtime class identification requires the use of the <TT>DECLARE_DYNAMIC</TT>
	macro in the class declaration and the <TT>IMPLEMENT_DYNAMIC</TT> macro in the class
	definition.<BR>
	<BR>
	
	<LI>Support for dynamic object creation requires the use of the <TT>DECLARE_DYNCREATE</TT>
	macro in the class declaration and the <TT>IMPLEMENT_DYNCREATE</TT> macro in the
	class definition. The use of dynamic object creation is discussed later in this hour.<BR>
	<BR>
	
	<LI>Serialization support requires the use of the <TT>DECLARE_SERIAL</TT> macro in
	the class declaration and the <TT>IMPLEMENT_SERIAL</TT> macro in the class definition.
	The use of serialization is discussed in Hour 22.
</UL>

<P>Each of the <TT>CObject</TT> macros is used in a similar way. All <TT>DECLARE</TT>
macros have one parameter--the name of the class. The <TT>IMPLEMENT</TT> macros generally
take two parameters--the name of the class and the name of the immediate base class.
<TT>IMPLEMENT_SERIAL</TT> is an exception because it requires three parameters, as
discussed in Hour 22.</P>
<P>Listing 8.7 is the class declaration for <TT>CMyObject</TT>, a simple class that
is derived from <TT>CObject</TT>. The <TT>CMyObject</TT> class supports dynamic creation,
so it includes the <TT>DECLARE_DYNCREATE</TT> macro.
<H4><FONT COLOR="#000077">TYPE: Listing 8.7. The CMyObject class declaration, using
CObject as a base class.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>class CMyObject : public CObject</TT>
<TT>{</TT>
<TT>    DECLARE_DYNCREATE( CMyObject );</TT>
<TT>// Constructor</TT>
<TT>public:</TT>
<TT>    CMyObject();</TT>
<TT>//Attributes</TT>
<TT>public:</TT>
<TT>    void Set( const CString&amp; szName );</TT>
<TT>    CString Get() const;</TT>
<TT>//Implementation</TT>
<TT>private:</TT>
<TT>    CString m_szName;</TT>
</FONT></PRE>
<P><TT>};</TT> Save the source code from Listing 8.7 in the Runtime project directory
as <TT>MyObj.h</TT>. It's just an <TT>include</TT> file, so don't add it to the project.</P>
<P>The source code for the <TT>CMyObject</TT> member functions is provided in Listing
8.8. Save this source code as <TT>MyObj.cpp</TT> and add it to the Runtime project.
This source file contains the <TT>IMPLEMENT_DYNCREATE</TT> macro that matches the
<TT>DECLARE_DYNCREATE</TT> macro from the class declaration.
<H4><FONT COLOR="#000077">TYPE: Listing 8.8. Member functions for the CMyObject class.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>#include &lt;afx.h&gt;</TT>
<TT>#include &quot;MyObj.h&quot;</TT>
<TT>IMPLEMENT_DYNCREATE( CMyObject, CObject );</TT>
<TT>CMyObject::CMyObject()</TT>
<TT>{</TT>
<TT>}</TT>
<TT>void CMyObject::Set( const CString&amp; szName )</TT>
<TT>{</TT>
<TT>    m_szName = szName;</TT>
<TT>}</TT>
<TT>CString CMyObject::Get() const</TT>
<TT>{</TT>
<TT>    return m_szName;</TT>
</FONT></PRE>
<P><TT>}</TT>


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲亚洲人成综合网络| 国产视频911| 在线欧美日韩国产| 丰满少妇久久久久久久| 国产盗摄视频一区二区三区| 久久99精品国产麻豆婷婷 | 94-欧美-setu| 成人丝袜视频网| 北岛玲一区二区三区四区| 成人福利在线看| 成人性生交大合| 99re成人精品视频| 在线观看不卡视频| 91麻豆精品国产91久久久资源速度| 欧美日韩激情一区| 日韩一区二区麻豆国产| 精品剧情在线观看| 中文字幕日本乱码精品影院| 中文字幕字幕中文在线中不卡视频| 亚洲欧美日韩在线不卡| 亚洲国产va精品久久久不卡综合| 午夜久久久影院| 精彩视频一区二区三区| a在线欧美一区| 欧美性大战久久久| 精品久久久久久久久久久久久久久 | 99re热视频精品| 欧美性色综合网| 精品国产一区二区三区四区四| 久久久三级国产网站| 亚洲色大成网站www久久九九| 亚洲a一区二区| 国产成人综合在线播放| 91豆麻精品91久久久久久| 91精品在线麻豆| 欧美国产激情一区二区三区蜜月| 亚洲一区自拍偷拍| 国产麻豆一精品一av一免费 | 亚洲日本在线看| 久久国产剧场电影| 99精品视频在线观看| 欧美本精品男人aⅴ天堂| 亚洲色图一区二区三区| 久久99精品网久久| 欧美性猛交xxxx黑人交| 国产三级精品三级在线专区| 石原莉奈一区二区三区在线观看| 国产mv日韩mv欧美| 欧美一级二级在线观看| 亚洲美女视频在线观看| 丰满少妇在线播放bd日韩电影| 欧美日韩一区二区三区在线看| 国产拍欧美日韩视频二区| 日韩激情视频网站| 欧美日韩一区二区欧美激情| 国产偷国产偷精品高清尤物 | 欧美亚洲一区二区在线观看| 久久久久亚洲蜜桃| 麻豆91精品视频| 欧美性猛交xxxx黑人交| 亚洲免费av高清| 国产精品69久久久久水密桃 | 国产精品88av| 日韩免费一区二区| 香蕉av福利精品导航| 色综合久久中文字幕综合网| 国产亚洲精品aa午夜观看| 激情久久五月天| 欧美第一区第二区| 日韩电影在线免费| 制服丝袜亚洲播放| 日本中文一区二区三区| 欧美高清精品3d| 日韩精品电影在线观看| 4438x亚洲最大成人网| 亚洲国产精品一区二区久久| 欧洲精品在线观看| 一区二区三区在线观看动漫| 91网站黄www| 亚洲成人第一页| 欧美日免费三级在线| 天天亚洲美女在线视频| 欧美一区午夜精品| 精品一区二区三区蜜桃| 国产无遮挡一区二区三区毛片日本| 国产自产高清不卡| 国产精品色在线| 91丝袜美女网| 亚洲成av人片www| 日韩欧美国产精品| 国产成人午夜片在线观看高清观看| 亚洲精品在线观看视频| 福利电影一区二区| 亚洲欧美一区二区三区国产精品| 91色porny| 午夜精品久久久久久久99水蜜桃| 欧美一区二区三区视频免费播放 | 国产精品毛片久久久久久久| av一二三不卡影片| 一区二区高清在线| 欧美一级午夜免费电影| 高清不卡在线观看| 亚洲国产日韩精品| 日韩精品在线看片z| 不卡一区二区三区四区| 日韩经典中文字幕一区| 久久久久9999亚洲精品| 在线免费观看日本欧美| 麻豆中文一区二区| 综合久久综合久久| 日韩免费一区二区三区在线播放| 丰满少妇在线播放bd日韩电影| 亚洲国产综合人成综合网站| 2022国产精品视频| 一本一道综合狠狠老| 久久精品免费观看| 亚洲免费在线视频| 久久综合狠狠综合久久激情 | 婷婷成人激情在线网| 久久久久亚洲蜜桃| 欧美精品九九99久久| 成人免费高清在线观看| 蜜桃在线一区二区三区| 樱花影视一区二区| 精品国产成人在线影院 | 精品久久99ma| 日本精品视频一区二区三区| 精品影院一区二区久久久| 一区二区日韩av| 国产精品传媒视频| 久久看人人爽人人| 欧美一三区三区四区免费在线看| 在线观看一区二区视频| www.亚洲色图.com| 国产美女在线观看一区| 奇米四色…亚洲| 亚洲成人在线网站| 一区二区三区在线观看网站| 中文字幕一区二| 国产精品理伦片| 国产欧美精品一区| 久久九九全国免费| 久久久综合视频| 欧美精品一区二区三区蜜臀| 日韩美女一区二区三区四区| 91精品久久久久久久91蜜桃| 欧美伊人久久久久久久久影院| 国产精品一品二品| 国产精品 日产精品 欧美精品| 奇米色777欧美一区二区| 亚洲综合色网站| 一区二区三区久久| 一区二区高清视频在线观看| 亚洲久草在线视频| 亚洲最色的网站| 亚洲精品成a人| 专区另类欧美日韩| 亚洲日本va在线观看| 亚洲欧美综合在线精品| 日韩伦理av电影| 一区二区三区国产| 亚洲成a人片在线观看中文| 亚洲线精品一区二区三区八戒| 一区二区三区 在线观看视频 | 裸体歌舞表演一区二区| 久久99久久99精品免视看婷婷| 精品制服美女丁香| 高清成人免费视频| 不卡一区二区中文字幕| 在线观看三级视频欧美| 欧美日韩国产色站一区二区三区| 欧美顶级少妇做爰| 久久婷婷一区二区三区| 国产欧美1区2区3区| 亚洲日本电影在线| 丝袜亚洲另类欧美| 免费观看一级特黄欧美大片| 国产在线观看一区二区| 高清成人免费视频| 欧美在线视频你懂得| 日韩美女在线视频| 国产精品久久久久久久久免费桃花 | 成人做爰69片免费看网站| 日本道色综合久久| 日韩欧美中文字幕精品| 国产精品美女久久久久久2018| 一级日本不卡的影视| 卡一卡二国产精品| 在线中文字幕一区| 精品国产百合女同互慰| 伊人一区二区三区| 精品一区二区三区不卡| 一本大道久久a久久综合| 欧美一区二区三区婷婷月色| 中文字幕第一区第二区| 日本不卡高清视频| 91亚洲午夜精品久久久久久| 日韩亚洲国产中文字幕欧美| 亚洲三级小视频| 国产成a人亚洲|