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

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

?? ch08.htm

?? Learning language of Visual C++6
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
	<DT></DT>
	<DD><B>5. </B>Arrange the check boxes under the radio buttons.
	<P>
	<DT></DT>
	<DD><B>6. </B>Click the Group box on the Controls floating toolbar, and then click
	and drag a group box around the radio buttons. Change the caption to <B>Text Color</B>.
	<P>
	<DT></DT>
	<DD><B>7. </B>Move the OK and Cancel buttons down to the bottom of the dialog box.
	<P>
	<DT></DT>
	<DD><B>8. </B>Select each horizontal group of controls and use Layout, Center in
	Dialog, Horizontal to make things neater.
	<P>
	<DT></DT>
	<DD><B>9. </B>Choose Edit, Select All, and then drag all the controls up toward the
	top of the dialog box. Shrink the dialog box to fit around the new controls. It should
	now resemble Figure 8.15.
	<P>
</DL>

<P><A HREF="javascript:popUp('08uvc15.gif')"><B>FIG. 8.15</B></A><B> </B><I>The Options
dialog box for ShowString has been expanded.</I></P>


<BLOCKQUOTE>
	<P>
<HR>
<strong>TIP:</strong> If you don't recognize the icons on the Controls toolbar, use the
	ToolTips<I>.</I> If you hold the cursor over any of the toolbar buttons, a tip pops
	up after a few seconds, telling you what control the button represents. 
<HR>


</BLOCKQUOTE>

<P>Finally, set the tab order by choosing Layout, Tab Order and then clicking the
controls, in this order:</P>

<DL>
	<DT></DT>
	<DD><B>1. </B>IDC_OPTIONS_STRING
	<P>
	<DT></DT>
	<DD><B>2. </B>IDC_OPTIONS_BLACK
	<P>
	<DT></DT>
	<DD><B>3. </B>IDC_OPTIONS_RED
	<P>
	<DT></DT>
	<DD><B>4. </B>IDC_OPTIONS_GREEN
	<P>
	<DT></DT>
	<DD><B>5. </B>IDC_OPTIONS_HORIZCENTER
	<P>
	<DT></DT>
	<DD><B>6. </B>IDC_OPTIONS_VERTCENTER
	<P>
	<DT></DT>
	<DD><B>7. </B>IDOK
	<P>
	<DT></DT>
	<DD><B>8. </B>IDCANCEL
	<P>
</DL>

<P>Then click away from the dialog box to leave the two static text controls as positions
9 and 10.</P>
<P>
<H3><A NAME="Heading14"></A>Adding Member Variables to the Dialog Box Class</H3>
<P>Having added controls to the dialog box, you need to add corresponding member
variables to the COptionsDialog class. Bring up ClassWizard, select the Member Variable
tab, and add member variables for each control. Figure 8.16 shows the summary of
the member variables created. The check boxes are connected to BOOL variables; these
member variables are TRUE if the box is selected and FALSE if it isn't. The radio
buttons are handled differently. Only the first--the one with the Group box selected
in its Properties dialog box--is connected to a member variable. That integer is
a zero-based index that indicates which button is selected. In other words, when
the Black button is selected, m_color is 0; when Red is selected, m color is 1; and
when Green is selected, m_color is 2.</P>
<P><A HREF="javascript:popUp('08uvc16.gif')"><B>FIG. 8.16</B></A><B> </B><I>Member
variables in the dialog box class are connected to individual controls or the group
of radio buttons.</I></P>
<P>
<H3><A NAME="Heading15"></A>Adding Member Variables to the Document</H3>
<P>The variables to be added to the document are the same ones that were added to
the dialog box. You add them to the CShowStringDoc class definition in the header
file, to OnNewDocument(), and to Serialize(). Add the lines in Listing 8.10 at the
top of the CShowStringDoc definition in ShowStringDoc.h, replacing the previous definition
of string and GetString(). Make sure that the variables are private and the functions
are public.</P>
<P>
<H4>Listing 8.10&#160;&#160;SHOWSTRINGDOC.H--CShowStringDoc Member Variables</H4>
<PRE>private:
    CString string;
    int    color;
    BOOL horizcenter;
    BOOL vertcenter;
public:
    CString GetString() {return string;}
    int    GetColor() {return color;}
    BOOL GetHorizcenter() {return horizcenter;}
</PRE>
<PRE>    BOOL GetVertcenter() {return vertcenter;}
</PRE>
<P>As with string, these are private variables with public get functions but no set
functions. All these options should be serialized; the new Serialize() is shown in
Listing 8.11. Change your copy by double-clicking the function name in ClassView
and adding the new code.</P>
<P>
<H4>Listing 8.11&#160;&#160;SHOWSTRINGDOC.CPP--Serialize()</H4>
<PRE>void CShowStringDoc::Serialize(CArchive&amp; ar)
{
    if (ar.IsStoring())
    {
        ar &lt;&lt; string;
        ar &lt;&lt; color;
        ar &lt;&lt; horizcenter;
        ar &lt;&lt; vertcenter;
    }
    else
    {
        ar &gt;&gt; string;
        ar &gt;&gt; color;
        ar &gt;&gt; horizcenter;
        ar &gt;&gt; vertcenter;
    }
</PRE>
<PRE>}
</PRE>
<P>Finally, you need to initialize these variables in OnNewDocument(). What are good
defaults for these new member variables? Black text, centered in both directions,
was the old behavior, and it makes sense to use it as the default. The new OnNewDocument()
is shown in Listing 8.12.</P>
<P>
<H4>Listing 8.12&#160;&#160;SHOWSTRINGDOC.CPP--OnNewDocument()</H4>
<PRE>BOOL CShowStringDoc::OnNewDocument()
{
    if (!CDocument::OnNewDocument())
        return FALSE;
    string = &quot;Hello, world!&quot;;
    color = 0;     //black
    horizcenter = TRUE;
    vertcenter = TRUE;
    return TRUE;
</PRE>
<PRE>}
</PRE>
<P>Of course, at the moment, users cannot change these member variables from the
defaults. To allow the user to change the variables, you have to change the function
that handles the dialog box.</P>
<P>
<H3><A NAME="Heading16"></A>Changing OnToolsOptions()</H3>
<P>The OnToolsOptions() function sets the values of the dialog box member variables
from the document member variables and then displays the dialog box. If the user
clicks OK, the document member variables are set from the dialog box member variables
and the view is redrawn. Having just added three member variables to the dialog box
and the document, you have three lines to add before the dialog box displays and
then three more to add in the block that's called after OK is clicked. The new OnToolsOptions()
is shown in Listing 8.13.</P>
<P>
<H4>Listing 8.13&#160;&#160;SHOWSTRINGDOC.CPP--OnToolsOptions()</H4>
<PRE>void CShowStringDoc::OnToolsOptions() 
{
    COptionsDialog dlg;
    dlg.m_string = string;
    dlg.m_color = color;
    dlg.m_horizcenter = horizcenter;
    dlg.m_vertcenter = vertcenter;
    
    if (dlg.DoModal() == IDOK)
    {
        string = dlg.m_string;
        color = dlg.m_color;
        horizcenter = dlg.m_horizcenter;
        vertcenter = dlg.m_vertcenter;
        SetModifiedFlag();
        UpdateAllViews(NULL);
    }
</PRE>
<PRE>}
</PRE>
<P>What happens when the user opens the dialog box and changes the value of a control,
say, by deselecting Center Horizontally? The framework--through Dialog Data Exchange
(DDX), as set up by ClassWizard--changes the value of COptionsDialog::m_horizcenter
to FALSE. This code in OnToolsOptions() changes the value of CShowStringDoc::horizcenter
to FALSE. When the user saves the document, Serialize() saves horizcenter. This is
all good, but none of this code actually changes the way the view is drawn. That
involves OnDraw().</P>
<P>
<H3><A NAME="Heading17"></A>Changing OnDraw()</H3>
<P>The single call to DrawText() in OnDraw() becomes a little more complex now. The
document member variables are used to set the view's appearance. Edit OnDraw() by
expanding CShowStringView in the ClassView and double-clicking OnDraw().</P>
<P>The color is set with CDC::SetTextColor() before the call to DrawText(). You should
always save the old text color and restore it when you are finished. The parameter
to SetTextColor() is a COLORREF, and you can directly specify combinations of red,
green, and blue as hex numbers in the form 0x00bbggrr, so that, for example, 0x000000FF
is bright red. Most people prefer to use the RGB macro, which takes hex numbers from
0x0 to 0xFF, specifying the amount of each color; bright red is RGB(FF,0,0), for
instance. Add the lines shown in Listing 8.14 before the call to DrawText() to set
up everything.</P>
<P>
<H4>Listing 8.14&#160;&#160;SHOWSTRINGDOC.CPP--OnDraw() Additions Before DrawText()
Call</H4>
<PRE>    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;
</PRE>
<PRE>    }
</PRE>
<P>Add this line after the call to DrawText():</P>
<P>
<PRE>pDC-&gt;SetTextColor(oldcolor);
</PRE>
<P>There are two approaches to setting the centering flags. The brute-force way is
to list the four possibilities (neither, horizontal, vertical, and both) and have
a different DrawText() statement for each. If you were to add other settings, this
would quickly become unworkable. It's better to set up an integer to hold the DrawText()
flags and OR in each flag, if appropriate. Add the lines shown in Listing 8.15 before
the call to DrawText().</P>
<P>
<H4>Listing 8.15&#160;&#160;SHOWSTRINGDOC.CPP--OnDraw() Additions After DrawText()
Call</H4>
<PRE>    int DTflags = 0;
    if (pDoc-&gt;GetHorizcenter())
    {
        DTflags |= DT_CENTER;
    }
    if (pDoc-&gt;GetVertcenter())
    {
        DTflags |= (DT_VCENTER|DT_SINGLELINE);
</PRE>
<PRE>    }
</PRE>
<P>The call to DrawText() now uses the DTflags variable:</P>
<P>
<PRE>pDC-&gt;DrawText(pDoc-&gt;GetString(), &amp;rect, DTflags);
</PRE>
<P>Now the settings from the dialog box have made their way to the dialog box class,
to the document, and finally to the view, to actually affect the appearance of the
text string. Build and execute ShowString and then try it. Any surprises? Be sure
to change the text, experiment with various combinations of the centering options,
and try all three colors.&#160;l</P>
<H1></H1>
<CENTER>
<P>
<HR>
<A HREF="../ch07/ch07.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"
ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch09/ch09.htm"><IMG
SRC="../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>
</P>

<P>&#169; <A HREF="../copy.htm">Copyright</A>, Macmillan Computer Publishing. All
rights reserved.
</CENTER>


</BODY>

</HTML>

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人动漫在线观看| 91福利区一区二区三区| 久久国产麻豆精品| 蜜臀久久99精品久久久画质超高清| 亚洲永久精品国产| 亚洲永久精品国产| 午夜精品视频一区| 香蕉乱码成人久久天堂爱免费| 性久久久久久久久| 免费观看一级欧美片| 麻豆91精品91久久久的内涵| 麻豆精品新av中文字幕| 久久69国产一区二区蜜臀 | 国产成人av一区二区三区在线| 日本免费新一区视频| 蜜臀久久99精品久久久画质超高清 | 色哟哟亚洲精品| 色婷婷综合中文久久一本| 日本大香伊一区二区三区| 在线观看亚洲成人| 7777精品久久久大香线蕉| 91精品国产手机| 26uuu色噜噜精品一区二区| 国产色产综合产在线视频| 国产女人18水真多18精品一级做| 国产精品午夜在线观看| 亚洲乱码中文字幕| 视频一区在线视频| 国产精品一区二区免费不卡 | 日韩亚洲欧美综合| 久久久99久久精品欧美| 亚洲欧洲99久久| 亚洲国产一区二区在线播放| 免费观看在线综合色| 成人午夜免费av| 欧美人狂配大交3d怪物一区| 精品区一区二区| 国产精品久久久久毛片软件| 一区二区三区四区五区视频在线观看 | 亚洲综合av网| 黄色成人免费在线| 成人高清免费观看| 欧美乱妇20p| 2024国产精品| 一区二区三区四区av| 麻豆精品一区二区av白丝在线| 成人av小说网| 欧美一区二区三区视频免费播放| 国产亚洲一区二区三区四区| 亚洲一区二区视频| 国产大片一区二区| 欧美视频中文字幕| 久久精品亚洲麻豆av一区二区 | 欧美亚洲综合久久| 久久综合久久综合九色| 一区二区三区四区不卡在线| 韩国欧美国产一区| 欧美亚洲综合另类| 中文字幕精品一区二区精品绿巨人| 五月综合激情婷婷六月色窝| 国产91精品免费| 51午夜精品国产| 亚洲免费观看高清完整版在线| 蜜桃av噜噜一区| 欧美性色综合网| 国产欧美一区二区三区鸳鸯浴| 午夜在线电影亚洲一区| 成人激情电影免费在线观看| 日韩精品一区二区三区swag| 亚洲午夜久久久| 高清av一区二区| 日韩免费视频一区| 亚洲五码中文字幕| www.视频一区| 久久久国产精品不卡| 免费看欧美美女黄的网站| 91国产免费看| 日韩一区在线播放| 国产风韵犹存在线视精品| 日韩欧美中文字幕精品| 一区二区三区在线观看网站| eeuss鲁一区二区三区| 久久久久国色av免费看影院| 美女在线视频一区| 欧美日韩一区 二区 三区 久久精品| 国产精品福利一区二区| 国产一区二区三区久久久| 日韩欧美中文字幕一区| 日本欧洲一区二区| 欧美一区二区三区四区高清 | 在线观看视频91| 日韩美女精品在线| hitomi一区二区三区精品| 久久日韩粉嫩一区二区三区| 黑人巨大精品欧美黑白配亚洲| 8v天堂国产在线一区二区| 午夜精彩视频在线观看不卡| 欧美在线播放高清精品| 亚洲一区精品在线| 欧美午夜免费电影| 一二三区精品视频| 在线精品视频小说1| 一区二区三区国产豹纹内裤在线 | 亚洲色图欧美偷拍| 91玉足脚交白嫩脚丫在线播放| 亚洲欧洲精品一区二区三区不卡 | 国产精品久久毛片a| 国产成人亚洲精品狼色在线| 国产亚洲人成网站| 福利一区二区在线观看| 国产精品亲子乱子伦xxxx裸| 成人性视频免费网站| 国产精品美女久久久久久久久久久| 国产成人免费在线观看| 国产精品免费视频网站| 99精品1区2区| 亚洲男人的天堂在线观看| 欧美在线色视频| 三级精品在线观看| 日韩免费成人网| 国产一区二区三区免费播放| 国产女主播一区| 99riav久久精品riav| 一区二区国产盗摄色噜噜| 欧美日韩另类国产亚洲欧美一级| 婷婷综合另类小说色区| 精品国产乱码久久久久久1区2区| 国产在线精品一区二区夜色 | 天堂va蜜桃一区二区三区漫画版| 777奇米成人网| 激情文学综合网| 国产精品乱码一区二三区小蝌蚪| 91麻豆.com| 日本不卡免费在线视频| 久久久99精品免费观看不卡| 色综合天天综合狠狠| 婷婷一区二区三区| 2021国产精品久久精品| 99久久夜色精品国产网站| 亚洲aⅴ怡春院| 久久精品男人的天堂| 色综合咪咪久久| 日本在线播放一区二区三区| 国产视频一区二区三区在线观看| 成人av动漫在线| 日韩精品成人一区二区在线| 久久久www成人免费无遮挡大片| 色天天综合色天天久久| 免费av成人在线| 亚洲国产高清aⅴ视频| 欧美日韩精品二区第二页| 国产原创一区二区三区| 亚洲一区二区三区三| 久久精品亚洲乱码伦伦中文| 欧美午夜一区二区三区免费大片| 久久99久久99精品免视看婷婷 | 精品综合久久久久久8888| 亚洲欧洲av在线| 337p日本欧洲亚洲大胆色噜噜| 在线视频一区二区三| 国产精品一区二区久激情瑜伽| 亚洲国产日韩a在线播放性色| 成人免费一区二区三区视频| 欧美蜜桃一区二区三区| 不卡视频一二三| 久久99精品久久久久| 一区二区三区四区在线免费观看| 久久精品夜色噜噜亚洲a∨| 欧美日韩日日摸| 91小视频免费观看| 国产成人午夜视频| 麻豆久久一区二区| 亚洲第一电影网| 亚洲欧洲中文日韩久久av乱码| 久久综合九色综合久久久精品综合 | 日韩视频一区二区| 欧美午夜电影在线播放| 97精品视频在线观看自产线路二| 久久66热re国产| 天天做天天摸天天爽国产一区 | 成人午夜激情视频| 久久国产麻豆精品| 日韩成人一区二区| 亚洲成人激情综合网| 综合欧美一区二区三区| 中文一区一区三区高中清不卡| 欧美v国产在线一区二区三区| 欧美日韩一区成人| 欧美亚洲免费在线一区| 91网页版在线| 波多野结衣精品在线| 国产成人8x视频一区二区| 精品一区中文字幕| 日本免费新一区视频| 五月激情丁香一区二区三区| 亚洲第一综合色| 亚洲图片欧美综合| 亚洲一区二区成人在线观看| 亚洲精品乱码久久久久久| 日韩一区欧美一区|