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

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

?? ch20.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<META NAME="GENERATOR" Content="Symantec Visual Page Mac 1.1">	<TITLE>Teach Yourself Visual C++&#174; 5 in 24 Hours -- Hour 20 -- Using ActiveX Controls</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><H1 ALIGN="CENTER"><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM"BORDER="0"><BR><FONT COLOR="#000077">Teach Yourself Visual C++&#174; 5 in 24 Hours</FONT></H1><CENTER><P><A HREF="../ch19/ch19.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch21/ch21.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> <HR></CENTER><H1 ALIGN="CENTER"><FONT COLOR="#000077">- Hour 20 -<BR>Using ActiveX Controls</FONT></H1><P>ActiveX controls enable you to reuse custom controls written for Windows. In thishour, I discuss ActiveX controls and how they are used. In this hour, you will learn<UL>	<LI>How ActiveX controls are used to replace OLE controls and VBX controls<BR>	<BR>		<LI>How you can use ActiveX controls to easily add functionality to your project<BR>	<BR>		<LI>How to use the Microsoft FlexGrid control included with Visual C++</UL><P>A small example at the end of the hour uses one of the ActiveX controls includedwith Visual C++.<H2><FONT COLOR="#000077"><B>What Is an ActiveX Control?</B></FONT></H2><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An <I>ActiveX control</I>is a reusable control that is packaged and available for use in your applications.ActiveX controls use Object Linking and Embedding (OLE) interfaces for communicationto and from the control.</P><P>ActiveX controls can be developed for both the 16-bit and 32-bit versions of Windows.In addition, they have features that make them more attractive for distribution,such as support for licensing and localization into different languages.</P><P>A wide range of ActiveX controls is available. Later in this hour, you can followthe steps required to use the Microsoft FlexGrid control that is included with VisualC++, which enables you to write simple spreadsheet applications.<H2><FONT COLOR="#000077"><B>Why Use an ActiveX Control?</B></FONT></H2><P>ActiveX controls are easy to use in your MFC-based applications because they havebeen designed for reuse. Developer Studio includes the Component and Controls Gallery,a tool that helps you easily integrate ActiveX controls into your MFC programs.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>ActiveX controls communicateover well-defined <I>interfaces</I> that are understood by ActiveX controls and theprograms that use them. These interfaces are used to pass information and eventsto and from the control.</P><P>Because ActiveX controls use a standard interface that is not specific to anyparticular programming language, ActiveX controls can be used by a variety of developmenttools. The ActiveX controls that you use today in a Visual C++ program can also beused with other tools, such as Access 95, Visual FoxPro, and Visual Basic.</P><P>ActiveX controls offer more functionality than is available with standard controlsoffered by Windows. For example, before the release of Windows 95, many VBX vendorsoffered VBX controls that were similar to tree view controls; these vendors are nowoffering ActiveX controls with features that are not available when using standardcontrols.<H2><FONT COLOR="#000077"><B>How Is an ActiveX Control Used?</B></FONT></H2><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An ActiveX <I>event</I> isa message that is sent from the control to the application that contains the control.</P><P>An ActiveX control always communicates with an ActiveX control container. Controlcontainers understand the ActiveX control interfaces, as shown in Figure 20.1. AnActiveX control container is responsible for providing an environment in which thecontrol can pass events to its owner and receive information from the outside world.The ActiveX control sends events to the ActiveX container when an event occurs insidethe control. Mouse clicks, pressed buttons, and expiring timers are examples of events.The ActiveX container provides information to the control such as the natural or&quot;ambient&quot; background color and the default font.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 20.1.</B> </A><I><BR>Messages sent to and from ActiveX controls in an MFC program.</I></P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An ActiveX <I>property</I>is an attribute that is applied to the control, such as a color or the height ofa button.</P><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>An ActiveX <I>method</I>is a function that is exposed by the control and is called by the control's container.</P><P>When an ActiveX control container must communicate with an ActiveX control, itinteracts with a set of properties and methods that are exposed by the ActiveX control.An example of an ActiveX property is the font or background color used by a control.An example of an ActiveX method is a function that sorts the items in a list control.</P><P>Every class derived from <TT>CWnd</TT> in an MFC application can be used as anActiveX control container. The MFC class <TT>COleControl</TT> is used as a base classfor all ActiveX controls created using MFC.<H3><FONT COLOR="#000077"><B>Using the Components and Controls Gallery</B></FONT></H3><P>The Developer Studio Components and Controls Gallery is used to store reusablecomponents that can be used in your MFC-based Windows projects. If you develop aclass that you would like to reuse in future projects, you can add the class to theGallery by following these steps:<DL>	<DD>1. Open the ClassView in the project workspace.<BR>	<BR>	2. Right-click on the class name, and select Add to Gallery from the shortcut menu.</DL><P>The most frequently used components stored in the Components and Controls Galleryare ActiveX controls. To display all the ActiveX controls available on your machine,open the Components and Controls Gallery by selecting Project | Add to Project |Components and Controls from the main menu.</P><P>After the Component Gallery dialog box is displayed, select Registered ActiveXControls from the list box; this displays all the available ActiveX controls, asshown in Figure 20.2.</P><P><A NAME="02"></A><A HREF="02.htm"><B>Figure 20.2.</B> </A><I><BR>Displaying available ActiveX controls in the Component Gallery.</I><H3><FONT COLOR="#000077"><B>Adding an ActiveX Control to the Dialog Editor</B></FONT></H3><P>Before using an ActiveX control in a dialog box, you must insert the control intothe dialog editor's control palette. To add an ActiveX control to the dialog editor,follow these steps:<DL>	<DD>1. Select one of the displayed ActiveX control icons.<BR>	<BR>	2. From the Components and Controls Gallery dialog box, click the Insert button.<BR>	<BR>	3. A message box will be displayed asking if you would like to insert the component.	Click OK.<BR>	<BR>	4. A list box containing classes that will be added to your project is displayed	inside the Confirm Classes dialog box. Click OK to add the classes to your project.<BR>	<BR>	5. Click the Close button to dismiss the Components and Controls Gallery dialog box.</DL><P>The ActiveX control you selected is now included in the dialog editor's controlpalette. Open a dialog box for editing, and you see the new control palette, includingthe new ActiveX control.</P><P>You can use the new ActiveX control as you would any other control. To add itto a dialog box resource, drag and drop the control on the dialog box, or selectthe ActiveX control's icon and click on the dialog box resource.<H3><FONT COLOR="#000077"><B>Using ClassWizard to Configure an ActiveX Control</B></FONT></H3><P>Before you can use the ActiveX control, it must be integrated into your project.As with any other control added to a dialog box, use ClassWizard to add message-handlingfunctions and associate the control with an MFC object.</P><P>When adding a member variable associated with an ActiveX control, you can useClassWizard as you would if the control were a button, list box, or another standardWindows control. Unlike standard Windows controls, each ActiveX control has a largenumber of variable types. In addition to the object used to interact with the control,every property exposed by the control can be associated with a variable.<H2><FONT COLOR="#000077"><B>An Example Using an ActiveX Custom Control</B></FONT></H2><P>As an example of using an ActiveX control in an MFC-based project, you will nowuse the Microsoft FlexGrid control in a dialog box-based application. The grid controlis used to create a small spreadsheet in the main dialog box.</P><P>To get started with the sample project, use AppWizard to create a dialog box-basedapplication named CustomCtrl. In contrast to most of the book's other AppWizard examples,for this project you must keep one of the default options offered by the wizard.On the second AppWizard page, make sure the ActiveX Controls check box is selected.Selecting this option causes AppWizard to configure the project to be ActiveX control-ready.<H3><FONT COLOR="#000077"><B>What Is a Grid Control?</B></FONT></H3><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>grid control</I> isa popular reusable component that is similar to a spreadsheet. Many suppliers ofVisual Basic controls offer grid controls, and Microsoft includes with DeveloperStudio an ActiveX grid control named FlexGrid.</P><P>As you can probably guess by its name, a grid control is divided into a seriesof rectangles, or grids. Vertical lines separate the controls into columns, and horizontallines divide the control into rows. The intersection of a row and column is knownas a <I>cell</I>.</P><P>A grid control can contain a mixture of images and text. In most cases, text isused. You cannot directly edit the individual cells in a grid control. The grid controlis strictly a read-only window, although there are ways to simulate cell editingthat are discussed later this hour.</P><P>The most common use for a grid control is creating a small spreadsheet. If youwant to display a small budget or other information, a grid control is ideal. Inaddition, you can use a grid control whenever you must arrange information into rowsand columns. For example, a calendar dialog box might use a grid control to provideaccess to the individual days of the month.</P><P>A grid control spares you the work of creating and maintaining a large numberof smaller controls. The grid control tracks the active cell, as well as the sizeand contents of each cell. When you need access to a particular cell, the grid controlcan provide that information through a function call. At a minimum, grid controlsenable you to do the following:<UL>	<LI>Retrieve current row, cell, and column information.<BR>	<BR>		<LI>Set attributes for the current cell, such as font, size, and contents.<BR>	<BR>		<LI>Retrieve the attributes of the current cell.</UL><H3><FONT COLOR="#000077"><B>Adding a Grid ActiveX Control to the Dialog Editor</B></FONT></H3><P>To add a grid ActiveX control to the CustomCtrl project's main dialog box, youmust first add the grid control to the dialog editor's control palette by followingthese steps:<DL>	<DD>1. Open the Components and Controls Gallery by selecting Project | Add to Project	| Components and Controls from the main menu.<BR>	<BR>	2. Display the available ActiveX controls by clicking Registered ActiveX Controls	from the list box.<BR>	<BR>	3. Select the Microsoft FlexGrid, version 5.0 Control icon and then click the Insert	button; then click OK on the message box.<BR>	<BR>	4. Accept the list of classes that will be added to the project by clicking OK.<BR>	<BR>	5. Close the Components and Controls Gallery dialog box.</DL><H3><FONT COLOR="#000077"><B>Adding a Grid Control to the Main Dialog Box</B></FONT></H3><P>Before adding the grid control to the main dialog box, you must first load thedialog box resource into the dialog editor. Open the ResourceView in the projectworkspace. Open the dialog box resource folder and double-click the <TT>IDD_CUSTOMCTRL_DIALOG</TT>icon. This opens the dialog box resource inside the Developer Studio dialog editor.</P><P>To add a grid control, drag and drop the grid control from the control paletteto the dialog box resource. For this example, you must also add an edit control witha resource ID of <TT>IDC_EDIT</TT> and a pushbutton control with an ID of <TT>IDC_CALC</TT>to the dialog box. The finished main dialog box resource is shown in Figure 20.3.</P><P><A NAME="03"></A><A HREF="03.htm"><B>Figure 20.3.</B></A> <I><BR>The main dialog box resource for the <TT>CustomCtrl</TT> project.</I></P><P>The properties for the ActiveX grid control are provided in Table 20.1. Use thedefault properties for the edit control.<H4><FONT COLOR="#000077">Table 20.1. Properties used for the ActiveX grid control.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>Property</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Value</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>ID</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_GRID</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Rows</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>5</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Cols</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>5</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>FixedRows</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>1</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>FixedCols</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>1</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>ScrollBars</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP">None</TD>	</TR></TABLE><H3><FONT COLOR="#000077"><B>Initializing the Grid Control</B></FONT></H3><P>Before adding the source code used to initialize the grid control, add membervariables to the <TT>CCustomCtrlDlg</TT> class associated with the grid and editcontrols. Using ClassWizard, add the member variables using the values from Table20.2.<H4><FONT COLOR="#000077">Table 20.2. Values used for the grid and edit control membervariables.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>Class Name</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Resource ID</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Category</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Type</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Variable Name</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CCustomCtrlDlg</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_EDIT</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Control</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CEdit</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>m_edit</TT></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CCustomCtrlDlg</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_GRID</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Control</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CMSFlexGrid</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>m_grid</TT></TD>	</TR></TABLE><BLOCKQUOTE>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区果冻传媒| 精品国产精品一区二区夜夜嗨| 日韩美女在线视频| 日本特黄久久久高潮| 91精品国产一区二区三区香蕉| 亚洲第一在线综合网站| 欧美理论电影在线| 麻豆免费精品视频| 国产精品毛片大码女人| 欧美视频日韩视频在线观看| 秋霞午夜av一区二区三区| 欧美国产一区二区在线观看| 欧美自拍偷拍午夜视频| 国产一区二区三区精品欧美日韩一区二区三区 | 久久综合av免费| 成a人片国产精品| 玉米视频成人免费看| 7777精品伊人久久久大香线蕉| 国产原创一区二区| 国产91丝袜在线播放| 婷婷成人综合网| 亚洲欧美日韩国产综合| 欧美成人性战久久| 欧美日韩一区 二区 三区 久久精品| 国内精品久久久久影院薰衣草| 亚洲一区二区在线视频| 国产婷婷色一区二区三区四区| 欧美四级电影在线观看| 日韩午夜中文字幕| 欧美视频一区二区三区在线观看 | 91香蕉视频污| 国内外成人在线| 丰满亚洲少妇av| 91精品福利视频| 国产91精品露脸国语对白| 色88888久久久久久影院按摩 | 国产成人在线影院| 国产精品小仙女| 色综合天天做天天爱| 国产一区二区在线影院| 色综合久久久网| 91尤物视频在线观看| 欧美精品自拍偷拍| 国产午夜亚洲精品不卡| 亚洲一区二区三区免费视频| 久久精品国产免费看久久精品| 亚洲一区二区三区在线看| 精品一区二区三区免费毛片爱| 性做久久久久久| 岛国精品在线观看| 成人久久视频在线观看| 欧美精品在线一区二区三区| 国产精品短视频| 中文字幕一区二区三区乱码在线 | 国产亚洲精品aa午夜观看| 亚洲午夜影视影院在线观看| 亚洲在线免费播放| 成人毛片视频在线观看| 日韩欧美卡一卡二| 亚洲一区二区三区爽爽爽爽爽| 国产一区二区在线视频| 日韩欧美亚洲另类制服综合在线| 亚洲免费观看高清完整版在线| 精品在线一区二区三区| 欧美日韩国产首页在线观看| 这里只有精品电影| 一区二区在线免费观看| 北条麻妃一区二区三区| 色婷婷国产精品| 国产精品系列在线| 国产精品一区二区三区四区| 欧美一三区三区四区免费在线看 | 色天使久久综合网天天| 中文字幕制服丝袜成人av | 亚洲欧美日韩国产另类专区| 国产精一品亚洲二区在线视频| 日韩午夜精品电影| 麻豆久久久久久久| 久久众筹精品私拍模特| 国产乱子伦视频一区二区三区| 精品福利av导航| 国产一区二区三区久久久| 久久精品男人天堂av| 国产99精品国产| 中文字幕亚洲精品在线观看| 91丨九色丨黑人外教| 亚洲一区国产视频| 欧美一区二区成人6969| 狠狠色丁香婷婷综合久久片| 久久久久久久av麻豆果冻| 一区二区在线电影| 欧美三级电影精品| 裸体在线国模精品偷拍| 国产日韩v精品一区二区| 亚洲综合一区二区精品导航| 欧美主播一区二区三区| 日韩在线a电影| 99久久夜色精品国产网站| 欧美一级欧美三级在线观看| 欧美aⅴ一区二区三区视频| 欧美一级日韩不卡播放免费| 国产做a爰片久久毛片| 欧美国产日韩一二三区| 在线区一区二视频| 极品少妇一区二区三区精品视频| 国产亚洲精品超碰| 欧洲日韩一区二区三区| 久久成人麻豆午夜电影| 国产精品私房写真福利视频| 一本久道中文字幕精品亚洲嫩| 亚洲图片一区二区| 久久久久久97三级| 欧美亚洲另类激情小说| 国产精品一区久久久久| 亚洲在线成人精品| 国产性色一区二区| 欧美日韩一区视频| 成人禁用看黄a在线| 奇米一区二区三区| 亚洲免费色视频| 国产亚洲欧美日韩俺去了| 宅男在线国产精品| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美欧美午夜aⅴ在线观看| 国产精品18久久久| 日韩不卡一区二区| 亚洲精品一卡二卡| 国产精品色呦呦| 日韩精品专区在线| 欧美绝品在线观看成人午夜影视| 国产成人亚洲综合a∨婷婷图片| 午夜精品久久久久久久| 亚洲欧美另类久久久精品2019| 2021国产精品久久精品| 欧美日韩国产一级| 欧美日韩综合不卡| 91麻豆成人久久精品二区三区| 国产一区三区三区| 美国欧美日韩国产在线播放| 亚洲五码中文字幕| 亚洲国产一区二区在线播放| 亚洲婷婷综合久久一本伊一区| 成人三级伦理片| 韩国av一区二区三区四区| 日本va欧美va瓶| 日韩av二区在线播放| 一区二区三区四区在线免费观看| 一本大道av伊人久久综合| 成人丝袜视频网| 国产69精品一区二区亚洲孕妇| 久久爱另类一区二区小说| 日韩经典一区二区| 轻轻草成人在线| 免费视频一区二区| 毛片一区二区三区| 麻豆精品国产91久久久久久| 免费av成人在线| 久88久久88久久久| 激情五月婷婷综合网| 国产呦精品一区二区三区网站| 国产黄色成人av| 99在线热播精品免费| 91女神在线视频| 欧美三级资源在线| 91精品久久久久久久91蜜桃 | 国产欧美一区二区在线观看| 国产午夜精品久久| 中文字幕一区三区| 一区二区三区日韩欧美| 亚洲美女在线国产| 日韩激情中文字幕| 国产在线视视频有精品| 白白色 亚洲乱淫| 欧美午夜寂寞影院| 欧美电影免费提供在线观看| 欧美精品一区二区三区蜜桃| 国产精品久久久久一区二区三区 | 久久久久久久综合| 亚洲欧洲在线观看av| 亚洲一级二级三级在线免费观看| 日韩不卡一二三区| 国产成人精品在线看| 色狠狠综合天天综合综合| 欧美一级在线观看| 亚洲色图.com| 美国精品在线观看| 色欧美片视频在线观看在线视频| 欧美日韩成人在线| 国产欧美日韩综合| 亚洲国产aⅴ成人精品无吗| 韩国在线一区二区| 欧美主播一区二区三区| 久久久久久毛片| 午夜精品久久久久久久久久久 | 亚洲午夜一区二区| 懂色一区二区三区免费观看| 欧美日韩视频在线观看一区二区三区| 精品国产百合女同互慰| 亚洲在线成人精品| 91一区一区三区|