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

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

?? ch20.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 2 頁
字號:
	<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>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久电影| 91在线porny国产在线看| 3d成人动漫网站| 天天爽夜夜爽夜夜爽精品视频| 在线精品国精品国产尤物884a| 亚洲一区二区三区视频在线| 91豆麻精品91久久久久久| 亚洲精品欧美激情| 欧美三级日韩在线| 欧美bbbbb| 亚洲精品在线观看视频| 国产成人一级电影| 亚洲欧美日韩久久| 欧美在线免费视屏| 美女脱光内衣内裤视频久久影院| 欧美精品一区二区精品网| 国产91丝袜在线18| 亚洲免费观看高清完整版在线观看 | 欧美大片国产精品| 国产精品影音先锋| 亚洲蜜臀av乱码久久精品| 欧美电影一区二区| 国产一区二区三区| 综合电影一区二区三区| 欧美性受xxxx黑人xyx性爽| 琪琪一区二区三区| 中文字幕成人网| 欧美日韩午夜在线| 国产精品自产自拍| 亚洲精品五月天| 日韩欧美国产三级电影视频| a级高清视频欧美日韩| 丝袜美腿成人在线| 国产日韩精品视频一区| 欧美日韩一区二区不卡| 国产精品一区三区| 午夜在线电影亚洲一区| 26uuu精品一区二区| 日本精品一级二级| 国产一区二区三区四区五区美女 | 久久精品视频一区二区三区| 一本一道久久a久久精品| 久久精品国产**网站演员| 综合婷婷亚洲小说| 2023国产精品视频| 欧美日韩在线播放三区| 成人中文字幕合集| 免费观看一级欧美片| 亚洲三级久久久| 26uuu国产电影一区二区| 在线国产亚洲欧美| 成人看片黄a免费看在线| 蜜桃久久久久久| 亚洲国产成人精品视频| 国产精品天干天干在线综合| 日韩免费在线观看| 欧美午夜免费电影| 96av麻豆蜜桃一区二区| 国产乱码精品一区二区三区av| 午夜国产不卡在线观看视频| 亚洲桃色在线一区| 国产精品久久久久桃色tv| 精品人在线二区三区| 欧美日本一区二区三区四区| 97久久人人超碰| av在线播放一区二区三区| 国产成人日日夜夜| 精品一区二区三区视频在线观看 | 亚洲另类在线视频| 欧美国产在线观看| 久久一区二区三区国产精品| 日韩亚洲欧美一区二区三区| 欧美日韩高清一区二区不卡| 欧美在线一二三| 在线视频综合导航| 日本高清不卡视频| 日本精品视频一区二区| 91视频国产观看| 色综合视频一区二区三区高清| 播五月开心婷婷综合| 成人午夜激情影院| 成人av影院在线| 成人午夜免费av| 成人午夜伦理影院| 91尤物视频在线观看| 91丝袜国产在线播放| 9色porny自拍视频一区二区| 91一区二区三区在线观看| 91免费版在线看| 一本大道久久a久久精二百| 色婷婷亚洲综合| 欧美午夜精品免费| 制服丝袜在线91| 欧美sm美女调教| 国产欧美精品一区| 国产精品区一区二区三| 亚洲人一二三区| 亚洲成av人片观看| 久久超级碰视频| 高清日韩电视剧大全免费| 91最新地址在线播放| 欧美性大战xxxxx久久久| 欧美日韩国产成人在线免费| 精品国产亚洲一区二区三区在线观看 | 欧美一二三四区在线| 精品乱人伦小说| 国产精品欧美一区二区三区| 亚洲黄色尤物视频| 秋霞成人午夜伦在线观看| 狠狠狠色丁香婷婷综合激情 | 精品久久久久久无| 欧美国产1区2区| 亚洲午夜激情网站| 久久99久久精品欧美| 国产白丝精品91爽爽久久| 色8久久精品久久久久久蜜| 欧美一级日韩免费不卡| 国产清纯在线一区二区www| 亚洲精品久久嫩草网站秘色| 免费精品视频在线| 99riav久久精品riav| 欧美高清视频一二三区| 日本一区二区不卡视频| 亚洲成人黄色影院| 激情五月播播久久久精品| 99在线精品观看| 欧美变态tickling挠脚心| 一区二区三区色| 国产精品亚洲午夜一区二区三区| 在线亚洲欧美专区二区| 欧美国产在线观看| 毛片av一区二区三区| 日本久久一区二区| 国产亚洲欧美在线| 日本亚洲三级在线| 91麻豆文化传媒在线观看| 精品国产91亚洲一区二区三区婷婷| 亚洲人一二三区| 国产精品乡下勾搭老头1| 欧美一区二区人人喊爽| 中文一区二区在线观看| 美女视频一区二区| 欧美日韩国产一区二区三区地区| 国产亚洲福利社区一区| 麻豆精品在线看| 欧美日韩一级二级三级| 国产精品成人网| 国产一区999| 欧美大片一区二区| 日韩精品久久理论片| 色欧美88888久久久久久影院| 国产亚洲欧美在线| 国内精品嫩模私拍在线| 欧美一级xxx| 天堂一区二区在线| 欧美色综合久久| 亚洲人妖av一区二区| 成人精品亚洲人成在线| 久久九九影视网| 国产真实乱对白精彩久久| 日韩三级.com| 日本在线不卡一区| 91精品免费在线| 日韩av电影天堂| 91精品视频网| 日本不卡不码高清免费观看| 欧美日本在线视频| 免费观看成人av| 欧美xingq一区二区| 激情综合亚洲精品| 精品理论电影在线| 精品影视av免费| 精品第一国产综合精品aⅴ| 久久99精品久久只有精品| 日韩精品自拍偷拍| 激情五月婷婷综合网| 日本一区二区动态图| 国产成人小视频| 亚洲日本va在线观看| 欧美三片在线视频观看| 婷婷综合五月天| 欧美一区二区三区婷婷月色 | 亚洲一卡二卡三卡四卡无卡久久| 在线观看一区不卡| 亚洲成在人线在线播放| 欧美一区二区播放| 国产一区二区三区日韩| 国产精品网站在线观看| 在线欧美日韩精品| 日韩精品一级中文字幕精品视频免费观看 | 制服丝袜亚洲网站| 国产伦精品一区二区三区视频青涩| 久久久久国产免费免费| 99久久精品一区二区| 亚洲国产欧美日韩另类综合| 欧美一区二区三区喷汁尤物| 激情综合色丁香一区二区| 欧美国产日韩a欧美在线观看| 色综合久久综合中文综合网| 丝袜亚洲精品中文字幕一区|