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

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

?? ch20.htm

?? 一天之內(nèi)學(xué)會(huì)VC#. 主要介紹VC#的各種應(yīng)用和示例
?? HTM
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>Due to the way	in which the Developer Studio tools are integrated, ClassWizard knows all about the	Microsoft FlexGrid control and understands that the <TT>CMSFlexGrid</TT> class is	used to interact with the control. <HR></BLOCKQUOTE><P>The main dialog box class, <TT>CCustomCtrlDlg</TT>, uses three new member variablesto interact with the grid control.<UL>	<LI><TT>m_nRow</TT> is used to store the current cell row when a cell is being edited.<BR>	<BR>		<LI><TT>m_nCol</TT> is used to store the current cell column when a cell is being	edited.<BR>	<BR>		<LI><TT>m_bEditing</TT> is set to <TT>TRUE</TT> when a cell is being edited and <TT>FALSE</TT>	otherwise.</UL><P>Add the declarations for these variables to the <TT>CCustomCtrlDlg</TT> class,as shown in Listing 20.1. Add the source code to the implementation section, justafter the <TT>// Implementation</TT> comment.<H4><FONT COLOR="#000077">TYPE: Listing 20.1. Modifications to the CCustomCtrlDlgclass declaration.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>// Implementation</TT><TT>protected:</TT><TT>    BOOL    m_bEditing;</TT><TT>    int     m_nRow;</TT></FONT></PRE><P><TT>int m_nCol;</TT> The grid control must be initialized during the main dialogbox's <TT>OnInitDialog</TT> member function. Add the source code from Listing 20.2to the <TT>CCustomCtrlDlg::OnInitDialog</TT> member function, just after the <TT>//TODO</TT> comment.<H4><FONT COLOR="#000077">TYPE: Listing 20.2. Initializing the ActiveX grid controlin OnInitDialog.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>// TODO: Add extra initialization here</TT><TT>m_bEditing = FALSE;</TT><TT>m_nRow = 1;</TT><TT>m_nCol = 1;</TT><TT>char*   arCols[4] = { &quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot; };</TT><TT>char*   arRows[4] = { &quot;Gas&quot;, &quot;Phone&quot;, &quot;MSN&quot;, &quot;Total&quot; };</TT><TT>m_grid.SetRow( 0 );</TT><TT>for( int nCol = 0; nCol &lt; 4; nCol++ )</TT><TT>{</TT><TT>    m_grid.SetCol( nCol + 1 );</TT><TT>    m_grid.SetText( arCols[nCol] );</TT><TT>}</TT><TT>m_grid.SetCol( 0 );</TT><TT>for( int nRow = 0; nRow &lt; 4; nRow++ )</TT><TT>{</TT><TT>    m_grid.SetRow( nRow + 1 );</TT><TT>    m_grid.SetText( arRows[nRow] );</TT></FONT></PRE><P><TT>}</TT> The source code added to the <TT>OnInitDialog</TT> function first initializesthe new member variables added in Listing 20.1. The remaining code initializes thegrid control.</P><P>The first <TT>for</TT> loop in Listing 20.2 sets the column headings to the firstfour months of the year. The next <TT>for</TT> loop sets the text used as row titlesin the grid control. This short snippet of code shows how a grid control is typicallyused: Select a cell and then set or retrieve the text stored in that cell.<H3><FONT COLOR="#000077"><B>Detecting Grid Control Events</B></FONT></H3><P>When an event occurs in the grid control, the control fires an event message toits container. The MFC framework translates this event message into a function call.To define the <TT>Click</TT> event message that is handled by the main dialog box,you use ClassWizard to add a message-handling function for the message, as shownin Table 20.3.<H4><FONT COLOR="#000077">Table 20.3. ActiveX event messages handled by the CCustomCtrlDlgclass.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>Object ID</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Class Name</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Message</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Function</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_GRID</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CCustomCtrlDlg</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>Click</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>OnClickGrid</TT></TD>	</TR></TABLE></P><P>Add the source code for the <TT>CCustomCtrlDlg::OnClickGrid</TT> function providedin List- ing 20.3.<H4><FONT COLOR="#000077">TYPE: Listing 20.3. Handling a mouse click event from theActiveX grid control.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CCustomCtrlDlg::OnClickGrid()</TT><TT>{</TT><TT>    CString szText = m_grid.GetText();</TT><TT>    if( m_bEditing == FALSE )</TT><TT>    {</TT><TT>        // Save the current grid position and set the edit flag.</TT><TT>        m_nRow = m_grid.GetRow();</TT><TT>        m_nCol = m_grid.GetCol();</TT><TT>        m_bEditing = TRUE;</TT><TT>        // Get the current grid text, and display it in the edit</TT><TT>        // control.</TT><TT>        szText = m_grid.GetText();</TT><TT>        m_edit.SetWindowText( szText );</TT><TT>        m_edit.ShowWindow( SW_SHOW );</TT><TT>        m_edit.SetFocus();</TT><TT>        m_edit.SetSel( 0, -1 );</TT><TT>    }</TT><TT>    else</TT><TT>    {</TT><TT>        // Roll up the edit control, and update the previous</TT><TT>        // grid position. You must save the current position,</TT><TT>        // go back to the old position, and then return to the</TT><TT>        // current position.</TT><TT>        int nCurrentRow = m_grid.GetRow();</TT><TT>        int nCurrentCol = m_grid.GetCol();</TT><TT>        m_grid.SetRow( m_nRow );</TT><TT>        m_grid.SetCol( m_nCol );</TT><TT>        m_grid.SetFocus();</TT><TT>        CString szEntry;</TT><TT>        m_edit.GetWindowText( szText );</TT><TT>        szEntry.Format(&quot;%01.2f&quot;, atof(szText) );</TT><TT>        m_edit.ShowWindow( SW_HIDE );</TT><TT>        m_grid.SetText( szEntry );</TT><TT>        m_bEditing = FALSE;</TT><TT>        m_grid.SetRow( nCurrentRow );</TT><TT>        m_grid.SetCol( nCurrentCol );</TT><TT>    }</TT></FONT></PRE><P><TT>}</TT> If the program receives a <TT>Click</TT> event, the <TT>m_bEditing</TT>flag is checked to see whether a cell is currently being edited. If not, the currentrow and column are collected from the grid control. This information is used laterwhen the editing job is finished. The text stored in the current grid cell is retrievedand displayed in the edit control. Finally, the edit control text is selected, whichmakes it easy for a user to overwrite the current contents.</P><P>If a cell is being edited, the text contained in the edit control is stored inthe grid. However, it must be stored in the cell that was originally clicked to openthe edit control. This cell position was stored when the edit control was openedand is now used to reset the current row and column. The edit control text is reformattedinto a standard dollars-and-cents format and stored in the original cell position.</P><P>The <TT>GetRow</TT> and <TT>GetCol</TT> functions provided by <TT>CGridCtrl</TT>are examples of ActiveX control methods that are exposed by the grid control. Fora complete list of exposed methods, open the project workspace view and click theClassView tab. Open the <TT>CGridCtrl</TT> class icon, and you see a list of theavailable member functions.<H3><FONT COLOR="#000077"><B>Recalculating the Grid Control Contents</B></FONT></H3><P>Each column in the spreadsheet is recalculated when you click the Calculate button.Add a message-handling function to the <TT>CCustomCtrlDlg</TT> class that handlesmessages from the Calculate button, using the values from Table 20.4.<H4><FONT COLOR="#000077">Table 20.4. Messages handled by the CCustomCtrlDlg class.</FONT></H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><B>Object ID</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Class Name</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Message</B></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><B>Function</B></TD>	</TR>	<TR ALIGN="LEFT" rowspan="1">		<TD ALIGN="LEFT" VALIGN="TOP"><TT>IDC_CALC</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>CCustomCtrlDlg</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>BN_CLICKED</TT></TD>		<TD ALIGN="LEFT" VALIGN="TOP"><TT>OnCalc</TT></TD>	</TR></TABLE></P><P>Add the source code in Listing 20.4 to the <TT>CCustomCtrlDlg::OnCalc</TT> memberfunction.<H4><FONT COLOR="#000077">TYPE: Listing 20.4. Recalculating the contents of the ActiveXgrid control.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CCustomCtrlDlg::OnCalc()</TT><TT>{</TT><TT>    // Close current editing job, if any.</TT><TT>    if( m_bEditing != FALSE )</TT><TT>    {</TT><TT>        CString szEntry, szText;</TT><TT>        m_edit.GetWindowText( szText );</TT><TT>        szEntry.Format(&quot;%01.2f&quot;, atof(szText) );</TT><TT>        m_edit.ShowWindow( SW_HIDE );</TT><TT>        m_grid.SetText( szEntry );</TT><TT>        m_bEditing = FALSE;</TT><TT>    }</TT><TT>    for( int nCol = 1; nCol &lt; 5; nCol++ )</TT><TT>    {</TT><TT>        double  dTotal = 0.0;</TT><TT>        m_grid.SetCol( nCol );</TT><TT>        for( int nRow = 1; nRow &lt; 4; nRow++ )</TT><TT>        {</TT><TT>            m_grid.SetRow( nRow );</TT><TT>            CString szCell = m_grid.GetText();</TT><TT>            dTotal += atof( szCell );</TT><TT>        }</TT><TT>        CString szTotal;</TT><TT>        szTotal.Format( &quot;%01.2f&quot;, dTotal );</TT><TT>        m_grid.SetRow( 4 );</TT><TT>        m_grid.SetText( szTotal );</TT><TT>    }</TT></FONT></PRE><P><TT>}</TT> Compile and run the <TT>CustomCtrl</TT> example. The grid control isinitially empty. Clicking on a cell displays the edit control, which enables youto enter or change the cell's contents. If you click on the cell again, the valuefrom the edit control is moved into the cell, and the edit control is hidden. Clickingthe Calculate button totals each column in the grid control and hides the edit control.Figure 20.4 shows the CustomCtrl main dialog box with some of the grid cells filledin.</P><P><A NAME="04"></A><A HREF="04.htm"><B>Figure 20.4.</B></A> <BR><I>The CustomCtrl project's main dialog box.</I><H2><FONT COLOR="#000077"><B>Summary</B></FONT></H2><P>In this hour, you learned about ActiveX controls and the Developer Studio toolsthat are used with them. As part of the discussion, you created an example that usedan ActiveX grid control as a small spreadsheet.<H2><FONT COLOR="#000077"><B>Q&amp;A</B></FONT></H2><DL>	<DD><B>Q How can I determine which events are provided by an ActiveX control?</B><BR>	<BR>	<B>A</B> After the ActiveX control is added to your project, you can use ClassWizard	to examine the events that are generated by the control.<BR>	<BR>	<B>Q How can I reuse controls installed on my computer by other applications?</B><BR>	<BR>	<B>A</B> Most commercial controls are licensed; they cannot be used to design new	applications without the proper ActiveX licensing file. Some controls can be used	for evaluation purposes, even without a license--to be sure, contact the control	vendor.</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. Where are reusable components stored in Developer Studio?<BR>	<BR>	2. What are some other development tools that support creating and using ActiveX	controls?<BR>	<BR>	3. What are some examples of events sent from an ActiveX control?<BR>	<BR>	4. What are some examples of properties exposed by ActiveX controls?<BR>	<BR>	5. What ActiveX control is often used to model a small spreadsheet?<BR>	<BR>	6. True or False: You can edit directly in a grid cell.<BR>	<BR>	7. What AppWizard option must be selected to allow an ActiveX control to work properly?<BR>	<BR>	8. What is an ActiveX method?<BR>	<BR>	9. True or False: ActiveX controls can be developed only for 32-bit systems.</DL><H3><FONT COLOR="#000077"><B>Exercises</B></FONT></H3><DL>	<DD>1. Modify the CustomCtrl project so that 12 months are displayed in the grid	and totals are provided for each row as well as for columns.<BR>	<BR>	2. Modify the CustomCtrl project so that the grid is recalculated automatically.<FONT	COLOR="#000077"></FONT></DL><CENTER><P><HR><A HREF="../ch21/ch21.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch23/ch23.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>

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区二区无线| 亚洲精品美国一| 国产精品福利av| 日韩毛片视频在线看| 亚洲成人综合在线| 美日韩一区二区| 成人少妇影院yyyy| 91行情网站电视在线观看高清版| 丝袜美腿亚洲综合| 日韩一二三区视频| 国产精品福利一区| 日本一不卡视频| 成人app网站| 欧美美女激情18p| 久久久国产一区二区三区四区小说 | 精品国产伦理网| 国产精品久久一级| 日韩av电影一区| 成人一区二区视频| 7777精品伊人久久久大香线蕉的| 欧美一区二区视频在线观看| 国产欧美视频在线观看| 中文字幕一区在线观看视频| 国产一区二区三区精品欧美日韩一区二区三区| 99精品桃花视频在线观看| 欧美精品高清视频| 亚洲一区二区三区四区中文字幕 | www.欧美.com| 一本大道久久a久久精品综合| 国产精品不卡一区二区三区| 国产成人在线视频免费播放| 久久综合久久综合久久| 久久99久国产精品黄毛片色诱| 丁香激情综合国产| 精品国产伦一区二区三区观看体验| 亚洲综合在线视频| 国产最新精品免费| 日韩精品一区二区三区在线播放| 一区二区三区四区激情| 国产成人免费视频网站| 久久精品国产精品亚洲红杏| 国产91精品免费| 国产日产精品1区| ...xxx性欧美| 日韩午夜在线观看| 成人久久久精品乱码一区二区三区| 亚洲成人一区在线| 欧美精品久久久久久久多人混战 | 6080国产精品一区二区| 午夜av一区二区| 久久久综合九色合综国产精品| 欧美午夜视频网站| 日韩专区中文字幕一区二区| 在线播放中文一区| 日韩av不卡在线观看| 精品嫩草影院久久| 91福利国产成人精品照片| 精品在线播放免费| 亚洲超碰精品一区二区| 玉米视频成人免费看| 精品视频在线免费| 91视频免费观看| 91精品国产综合久久久久久久久久 | 欧洲生活片亚洲生活在线观看| 夜色激情一区二区| 91精品欧美一区二区三区综合在| 蜜乳av一区二区三区| 国产午夜一区二区三区| 成人看片黄a免费看在线| 尤物在线观看一区| 欧美一区二区视频在线观看2022 | 亚洲男人天堂一区| 欧美日韩精品免费| 国产乱人伦偷精品视频免下载| 国产精品色呦呦| 欧美伊人久久大香线蕉综合69| 天天综合色天天综合| 久久蜜桃av一区精品变态类天堂 | 色婷婷激情久久| 三级一区在线视频先锋| 久久久久久久综合色一本| 欧美一区二区国产| 久久草av在线| 欧美肥妇bbw| 亚洲一区二区av在线| 日韩女优毛片在线| www.日韩av| 免费欧美日韩国产三级电影| 中文字幕av资源一区| 欧美体内she精高潮| 国精品**一区二区三区在线蜜桃| 国产精品看片你懂得 | 韩国成人在线视频| 成人欧美一区二区三区小说| 欧美日韩不卡视频| 国产成a人亚洲精| 亚洲成人7777| 亚洲国产高清aⅴ视频| 欧美精品1区2区3区| 成人av中文字幕| 日韩激情中文字幕| 中文字幕在线一区二区三区| 欧美精品视频www在线观看| 粉嫩一区二区三区性色av| 丝袜国产日韩另类美女| 国产精品天干天干在线综合| 欧美日本韩国一区二区三区视频| 高清成人免费视频| 日韩电影免费一区| 亚洲色欲色欲www| 精品国产三级电影在线观看| 在线免费观看日本一区| 国产精品亚洲第一区在线暖暖韩国| 亚洲成人精品一区| 中文乱码免费一区二区| 欧美一级片在线观看| 99精品欧美一区二区三区小说| 免费成人在线播放| 亚洲成人精品在线观看| 亚洲青青青在线视频| 国产三级精品三级| 日韩欧美的一区| 欧美日韩一区久久| 91免费精品国自产拍在线不卡| 韩国欧美国产一区| 麻豆精品精品国产自在97香蕉| 亚洲综合区在线| 国产精品久久久久7777按摩| 久久久天堂av| 日韩精品专区在线影院观看| 欧美日韩精品欧美日韩精品一 | 久久国产免费看| 日韩电影在线看| 亚洲成人在线免费| 亚洲综合久久久久| 亚洲激情在线激情| 亚洲美女在线国产| 国产精品久久久久久久久久免费看| 91在线观看地址| 久久精品国产久精国产爱| 日韩一区欧美二区| 亚洲日本乱码在线观看| 2023国产精华国产精品| 日韩欧美一区在线| 91.com在线观看| 欧美中文字幕不卡| 国产成人aaaa| 成人av网站在线| 国产一区二区看久久| 毛片一区二区三区| 亚洲精品久久久久久国产精华液| 国产精品不卡在线| 国产精品久久一级| 国产欧美va欧美不卡在线| 精品国产123| 欧美剧情电影在线观看完整版免费励志电影 | 91精品免费在线观看| 欧洲日韩一区二区三区| 91在线观看高清| 91在线云播放| 成人美女视频在线看| 国产成人自拍网| 懂色av一区二区三区免费观看| 国产一区不卡视频| 成熟亚洲日本毛茸茸凸凹| 国产乱子伦一区二区三区国色天香| 免费观看一级欧美片| 秋霞电影网一区二区| 午夜国产精品一区| 婷婷开心久久网| 日本视频一区二区| 蜜臀va亚洲va欧美va天堂 | 国产精品私人自拍| 国产精品久久毛片av大全日韩| 国产亚洲精品中文字幕| 中文字幕免费不卡在线| 中国av一区二区三区| 国产精品女同一区二区三区| 国产人久久人人人人爽| 国产精品美女久久久久久2018| 国产精品无人区| 国产精品夫妻自拍| 玉米视频成人免费看| 亚洲高清中文字幕| 一区二区三区四区精品在线视频| 亚洲五码中文字幕| 日韩精品一卡二卡三卡四卡无卡| 日韩精品电影一区亚洲| 国产一区二区在线观看视频| 国产精品一区二区在线观看网站| 懂色av噜噜一区二区三区av| 不卡的电视剧免费网站有什么| 在线免费不卡视频| 欧美高清激情brazzers| 欧美电影免费观看高清完整版| 久久久九九九九| 亚洲综合av网| 久久精品噜噜噜成人88aⅴ| 国产精品一区二区在线看| 成人a级免费电影|