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

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

?? ch16.htm

?? Learning language of Visual C++6
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
and then don't implement a Set function.</P>
<P><A HREF="javascript:popUp('16uvc01.gif')"><B>FIG. 16.1</B></A><B> </B><I>ClassWizard's
Automation page handles most of the work of building an Automation server.</I></P>
<P>For the purposes of this chapter, you'll add the two centering flags to the CShowStringDoc
class with Get and Set functions and add the string and color properties as direct-access
properties. To do so, follow these steps:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>Make sure that CShowStringDoc is the selected class, and then click
	the Add Property button to bring up the Add Property dialog box.
	<P>
	<DT></DT>
	<DD><B>2. </B>Type <B>String</B> in the External Name box. ClassWizard types along
	with you, filling in the Variable Name and Notification Function boxes for you.
	<P>
	<DT></DT>
	<DD><B>3. </B>Choose CString from the drop-down list box for Type. The dialog box
	should resemble Figure 16.2.
	<P>
	<DT></DT>
	<DD><B>4. </B>Click OK, click Add Property again, and then add Color as a direct-access
	property (see Figure 16.3). Use short as the data type.
	<P>
	<DT></DT>
	<DD><B>5. </B>Click OK, click Add Property again, and then add HorizCenter.
	<P>
	<DT></DT>
	<DD><B>6. </B>Choose BOOL for the type and then select the Get/Set Methods radio
	button. The Variable Name and Notification Function boxes are replaced by Get Function
	and Set Function, already filled in, as shown in Figure 16.4. (If the type changes
	from BOOL, choose BOOL again.) Click OK.
	<P>
	<DT></DT>
	<DD><B>7. </B>Add VertCenter in the same way that you added HorizCenter.
	<P>
</DL>

<P><A HREF="javascript:popUp('16uvc02.gif')"><B>FIG. 16.2</B></A><B> </B><I>Add String
as a direct-access property.</I></P>
<P><A HREF="javascript:popUp('16uvc03.gif')"><B>FIG. 16.3</B></A><B> </B><I>Add Color
as a direct-access property.</I></P>
<P><A HREF="javascript:popUp('16uvc04.gif')"><B>FIG. 16.4</B></A><B> </B><I>Add HorizCenter
as a Get/Set method property.</I></P>


<BLOCKQUOTE>
	<P>
<HR>
<BR>
	<strong>CAUTION:</strong><B> </B>After you click OK to add a property, you can't change
	the type, external name, or other properties of the property. You have to delete
	it and then add one that has the new type, or external name, or whatever. Always
	look over the Add Property dialog box before clicking OK. 
<HR>


</BLOCKQUOTE>

<P>Figure 16.5 shows the ClassWizard summary of exposed properties and methods. The
details of each property are shown in the Implementation box below the list of properties.
In Figure 16.5, VertCenter is highlighted, and the Implementation box reminds you
that VertCenter has a Get function and a Set function, showing their declarations.
Click OK to close ClassWizard.</P>
<P><A HREF="javascript:popUp('16uvc05.gif')"><B>FIG. 16.5</B></A><B> </B><I>ClassWizard
provides a summary of the properties you've added.</I></P>
<P>It should come as no surprise that as a result of these additions, ClassWizard
has changed the header and source files for CShowStringDoc. Listing 16.7 shows the
new dispatch map in the header file.</P>
<P>
<H4>Listing 16.7&#160;&#160;ShowStringDoc.h--Dispatch Map</H4>
<PRE>//{{AFX_DISPATCH(CShowStringDoc)
CString m_string;
afx_msg void OnStringChanged();
short m_color;
afx_msg void OnColorChanged();
afx_msg BOOL GetHorizCenter();
afx_msg void SetHorizCenter(BOOL bNewValue);
afx_msg BOOL GetVertCenter();
afx_msg void SetVertCenter(BOOL bNewValue);
//}}AFX_DISPATCH
</PRE>
<PRE>DECLARE_DISPATCH_MAP()
</PRE>
<P>Two new member variables have been added: m_string and m_color.</P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>NOTE:</strong> It's natural to wonder whether these are actually public member variables;
	they aren't. Just above this dispatch map is this line:</P>
	<PRE>DECLARE_MESSAGE_MAP()</PRE>
	<P>That macro, when it expands, declares a number of protected variables. Because
	these declarations are immediately afterward, they are protected member variables
	and protected functions. They're accessed in just the same way that protected message-catching
	functions are--they're called by a member function hidden in the class that directs
	traffic by using these maps. 
<HR>


</BLOCKQUOTE>

<P>A block of code has been added in the source file, but it's boring, as you can
see by looking at Listing 16.8.</P>
<P>
<H4>Listing 16.8&#160;&#160;ShowStringDoc.cpp--Notification, Get, and Set Functions</H4>
<PRE>/////////////////////////////////////////////////////////
// CShowStringDoc commands
void CShowStringDoc::OnColorChanged()
{
     // TODO: Add notification handler code
}
void CShowStringDoc::OnStringChanged()
{
     // TODO: Add notification handler code
}
BOOL CShowStringDoc::GetHorizCenter()
{
     // TODO: Add your property handler here
     return TRUE;
}
void CShowStringDoc::SetHorizCenter(BOOL bNewValue)
{
     // TODO: Add your property handler here
}
BOOL CShowStringDoc::GetVertCenter()
{
     // TODO: Add your property handler here
     return TRUE;
}
void CShowStringDoc::SetVertCenter(BOOL bNewValue)
{
     // TODO: Add your property handler here
</PRE>
<PRE>}
</PRE>
<P>The class still doesn't have member variables for the centering flags. (You might
have decided to implement these in some other way than as two simple variables, so
ClassWizard doesn't even try to guess what to add.) Add them by hand to the header
file, ShowStringDoc.h, as private member variables:</P>
<P>
<PRE>// Attributes
private:
     BOOL m_horizcenter;
     BOOL m_vertcenter;
</PRE>
<P>Now you can write their Get and Set functions; Listing 16.9 shows the code.</P>
<P>
<H4>Listing 16.9&#160;&#160;ShowStringDoc.cpp--Get and Set Functions for the Centering
<BR>
Flags</H4>
<PRE>BOOL CShowStringDoc::GetHorizCenter()
{
     return m_horizcenter;
}
void CShowStringDoc::SetHorizCenter(BOOL bNewValue)
{
     m_horizcenter = bNewValue;
}
BOOL CShowStringDoc::GetVertCenter()
{
     return m_vertcenter;
}
void CShowStringDoc::SetVertCenter(BOOL bNewValue)
{
     m_vertcenter = bNewValue;
</PRE>
<PRE>}
</PRE>
<H3><A NAME="Heading4"></A>The OnDraw() Function</H3>
<P>Restoring the member variables takes you halfway to the old functionality of ShowString.
Changing the view's OnDraw() function will take you most of the rest of the way.</P>
<P>To write a version of OnDraw() that shows a string properly, you have a fair amount
of background work to do. Luckily, you can open an old version of ShowString from
your own work in Chapter 8, &quot;Building a Complete Application: ShowString,&quot;
and paste in the following bits of code. (If any of this code is unfamiliar to you,
Chapter 8 explains it fully.) First, CShowStringDoc::OnNewDocument() in Listing 16.10
should initialize the member variables.</P>
<P>
<H4>Listing 16.10&#160;&#160;ShowStringDoc.cpp--CShowStringDoc::OnNewDocument()</H4>
<PRE>BOOL CShowStringDoc::OnNewDocument()
{
     if (!CDocument::OnNewDocument())
          return FALSE;
     m_string = &quot;Hello, world!&quot;;
     m_color = 0;     //black
     m_horizcenter = TRUE;
     m_vertcenter = TRUE;
     return TRUE;
</PRE>
<PRE>}
</PRE>
<P>Next, edit the document's Serialize function. Listing 16.11 shows the new code.</P>
<P>
<H4>Listing 16.11&#160;&#160;ShowStringDoc.cpp--CShowStringDoc::Serialize()</H4>
<PRE>void CShowStringDoc::Serialize(CArchive&amp; ar)
{
     if (ar.IsStoring())
     {
          ar &lt;&lt; m_string;
          ar &lt;&lt; m_color;
          ar &lt;&lt; m_horizcenter;
          ar &lt;&lt; m_vertcenter;
     }
     else
     {
          ar &gt;&gt; m_string;
          ar &gt;&gt; m_color;
          ar &gt;&gt; m_horizcenter;
          ar &gt;&gt; m_vertcenter;
     }
</PRE>
<PRE>}
</PRE>
<P>Finally, the view's OnDraw() function in Listing 16.12 actually shows the string.</P>
<P>
<H4>Listing 16.12&#160;&#160;ShowStringView.cpp--CShowStringView::OnDraw()</H4>
<PRE>void CShowStringView::OnDraw(CDC* pDC)
{
     CShowStringDoc* pDoc = GetDocument();
     ASSERT_VALID(pDoc);
     COLORREF oldcolor;
     switch (pDoc-&gt;GetColor())
     {
     case 0:
          oldcolor = pDC-&gt;SetTextColor(RGB(0,0,0)); //black
          break;
     case 1:
          oldcolor = pDC-&gt;SetTextColor(RGB(0xFF,0,0)); //red
          break;
     case 2:
          oldcolor = pDC-&gt;SetTextColor(RGB(0,0xFF,0)); //green
          break;
     }
     int DTflags = 0;
     if (pDoc-&gt;GetHorizcenter())
     {
          DTflags |= DT_CENTER;
     }
     if (pDoc-&gt;GetVertcenter())
     {
          DTflags |= (DT_VCENTER|DT_SINGLELINE);
     }
     CRect rect;
     GetClientRect(&amp;rect);
     pDC-&gt;DrawText(pDoc-&gt;GetString(), &amp;rect, DTflags);
     pDC-&gt;SetTextColor(oldcolor);
</PRE>
<PRE>}
</PRE>
<P>When you added m_string, m_color, m_horizcenter, and m_vertcenter to the document
with ClassWizard, they were added as protected member variables. This view code needs
access to them. As you can see, the view calls public functions to get to these member
variables of the document.</P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>NOTE:</strong> You could have chosen instead to make the view a friend to the document
	so that it could access the member variables directly, but that would give view functions
	the capability to use and change all private and protected member variables of the
	document. This more limited access is more appropriate and better preserves encapsulation.
	Encapsulation and other object-oriented concepts are discussed in Appendix A, &quot;
	C++ Review and Object-Oriented Concepts.&quot; 
<HR>


</BLOCKQUOTE>

<P>Several functions already in the document class access these variables, but they're
protected functions for use by ActiveX. The four public functions you'll add won't
be able to use those names, because they're taken, and will have to have not-so-good
names. Add them inline, as shown in Listing 16.13, to ShowStringDoc.h.</P>
<P>
<H4>Listing 16.13&#160;&#160;ShowStringDoc.h--Public Access Functions</H4>
<PRE>public:
     CString GetDocString() {return m_string;}
     int     GetDocColor() {return m_color;}
     BOOL GetHorizcenter() {return m_horizcenter;}
</PRE>
<PRE>     BOOL GetVertcenter() {return m_vertcenter;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
五月婷婷色综合| 成人动漫av在线| 高清不卡一区二区在线| 欧美私模裸体表演在线观看| 国产视频视频一区| 日日夜夜精品视频免费| 在线中文字幕一区| 国产精品久久看| 国产美女精品人人做人人爽| 欧美一区二区精品| 亚洲一区二区欧美激情| av电影在线观看一区| 国产三级欧美三级日产三级99| 婷婷中文字幕综合| 欧美视频三区在线播放| 亚洲人成7777| 99re热这里只有精品视频| 久久香蕉国产线看观看99| 免费三级欧美电影| 欧美日韩国产a| 天天av天天翘天天综合网| 91福利区一区二区三区| 亚洲激情综合网| 91黄色免费观看| 一区二区三区四区在线播放 | 一区二区三区四区视频精品免费| 国产69精品久久99不卡| 日本一区二区三区四区| 国产99久久久精品| 国产精品美女久久久久久久| 国产精品综合一区二区三区| 国产亚洲欧美激情| 成人a免费在线看| 亚洲三级小视频| 欧美视频一区在线观看| 日韩精品亚洲一区二区三区免费| 欧美老人xxxx18| 美女网站在线免费欧美精品| 精品国产欧美一区二区| 国产剧情一区二区| 一区视频在线播放| 欧美亚日韩国产aⅴ精品中极品| 一区二区三区.www| 欧美一区午夜精品| 精品一区二区三区欧美| 国产欧美一区二区精品性色 | 亚洲欧美另类综合偷拍| 91蜜桃网址入口| 亚洲高清在线精品| 日韩三级视频在线观看| 国产激情精品久久久第一区二区| 中文字幕不卡在线| 欧美在线观看视频一区二区| 日韩av一区二区三区四区| 久久久久久久久一| 91美女片黄在线观看91美女| 一区2区3区在线看| 日韩一区二区三区三四区视频在线观看 | 欧美aa在线视频| 国产欧美精品一区| 欧美日韩免费高清一区色橹橹 | 久久综合色播五月| 91小视频在线免费看| 日韩精品免费视频人成| 日本一区二区三区久久久久久久久不| 91网页版在线| 久久99精品一区二区三区| 中文字幕一区免费在线观看| 91精品国产免费| jlzzjlzz国产精品久久| 奇米亚洲午夜久久精品| 国产精品久久久久三级| 日韩视频免费观看高清完整版 | 亚洲精品ww久久久久久p站| 欧美电影免费观看高清完整版在线观看| 成人综合婷婷国产精品久久蜜臀 | 亚洲一区二区视频在线观看| 日韩精品一区二区三区视频| 色视频欧美一区二区三区| 国产精品自拍一区| 丝袜美腿亚洲综合| 亚洲男人的天堂在线aⅴ视频 | 日韩欧美综合在线| 色噜噜狠狠成人中文综合| 风间由美性色一区二区三区| 青娱乐精品在线视频| 亚洲精品国久久99热| 欧美国产精品中文字幕| 精品久久久久久无| 91麻豆精品久久久久蜜臀 | 欧美精品一区视频| 7777精品伊人久久久大香线蕉完整版| 成人高清免费观看| 日韩**一区毛片| 午夜精品在线看| 亚洲一级不卡视频| 亚洲免费av高清| 亚洲三级在线免费观看| 国产欧美一区二区精品久导航 | 欧美美女喷水视频| 91高清在线观看| 一道本成人在线| 91一区二区在线| 91视频在线观看免费| 国产精品1区2区3区| 精品一区二区影视| 国内成人自拍视频| 极品瑜伽女神91| 韩国女主播成人在线| 男女男精品视频网| 毛片基地黄久久久久久天堂| 日韩在线卡一卡二| 日本不卡123| 激情五月激情综合网| 黄页网站大全一区二区| 国产老女人精品毛片久久| 国产伦精品一区二区三区免费迷| 国产一区中文字幕| 国产精品亚洲一区二区三区妖精| 国产裸体歌舞团一区二区| 国产成人免费高清| 成人午夜在线视频| eeuss鲁片一区二区三区在线观看| 成人高清在线视频| 色综合久久精品| 欧美喷水一区二区| 日韩欧美中文字幕精品| 欧美不卡激情三级在线观看| xfplay精品久久| 亚洲欧洲韩国日本视频| 自拍视频在线观看一区二区| 亚洲综合一区二区| 日本aⅴ精品一区二区三区| 国产一区视频网站| 99久久久精品| 4438成人网| 国产婷婷色一区二区三区四区| 国产精品进线69影院| 亚洲一区二区成人在线观看| 日本欧美一区二区| 高清国产一区二区| 欧美伊人精品成人久久综合97| 日韩欧美一级精品久久| 国产欧美日本一区视频| 亚洲国产日韩av| 国产在线乱码一区二区三区| 97久久久精品综合88久久| 91精品免费在线观看| 国产日韩高清在线| 亚洲一区二区三区视频在线| 狠狠狠色丁香婷婷综合激情| 色女孩综合影院| 日韩视频在线一区二区| 1区2区3区国产精品| 天堂在线亚洲视频| 99视频一区二区| 精品黑人一区二区三区久久| 亚洲日本乱码在线观看| 精品在线观看视频| 欧美日韩一区二区三区视频| 国产日韩精品久久久| 日韩中文字幕一区二区三区| av在线一区二区| 精品国内二区三区| 无码av中文一区二区三区桃花岛| 国产精品1区二区.| 日韩欧美国产电影| 亚洲一区日韩精品中文字幕| 成人动漫在线一区| 精品美女在线播放| 丝袜诱惑制服诱惑色一区在线观看 | 国产传媒日韩欧美成人| 欧美二区乱c少妇| 亚洲视频免费在线观看| 国产露脸91国语对白| 日韩欧美激情一区| 午夜精品久久久久久久99水蜜桃| 99国产精品久| 亚洲国产精品av| 99久久伊人精品| 国产精品三级视频| 国产毛片精品视频| 日韩欧美你懂的| 欧美a一区二区| 欧美美女一区二区| 亚洲va韩国va欧美va| 91丨九色丨蝌蚪富婆spa| 国产日韩欧美一区二区三区综合| 久久精品99国产精品| 日韩欧美激情一区| 久久成人麻豆午夜电影| 日韩一二三区视频| 美女视频黄久久| 日韩视频免费观看高清完整版在线观看 | 久国产精品韩国三级视频| 欧美精品自拍偷拍| 日韩高清在线电影| 日韩欧美国产午夜精品| 久久99国产乱子伦精品免费| 日韩一区二区三区免费观看|