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

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

?? ch07.htm

?? 24小時學會vc++
?? HTM
?? 第 1 頁 / 共 3 頁
字號:
	<LI>Disabled	<LI>Group	<LI>Tab Stop	<LI>Owner Draw	<LI>Has Strings	<LI>Sort	<LI>Vertical Scroll	<LI>No Integral Height	<LI>Help ID	<LI>Disable No Scroll</UL><P>The following combo box properties are identical to properties offered for editcontrols (discussed in Hour 6, &quot;Using Edit Controls&quot;):<UL>	<LI>Auto HScroll	<LI>OEM Convert</UL><P>These two properties are unique to combo box controls:<UL>	<LI>List Choices, used to list items that appear by default when the dialog box is	created. Press Ctrl+Enter after each entry.<BR>	<BR>		<LI>Type, used to specify the type of the combo box. You can choose between Simple,	Dropdown, and Drop List. Dropdown is the default choice.</UL><H4><FONT COLOR="#000077">Adding Items to a Combo Box</FONT></H4><P>You add strings to combo boxes just as you add them to list boxes. Just like <TT>CListBox</TT>,the <TT>CComboBox</TT> class contains <TT>AddString</TT> and <TT>InsertString</TT>member functions:</P><PRE><FONT COLOR="#0066FF"><TT>comboBox.AddString( &quot;Riley&quot; );</TT></FONT></PRE><P>or</P><PRE><FONT COLOR="#0066FF"><TT>comboBox.InsertString( 0, &quot;Mitch&quot; );</TT></FONT></PRE><P>All positions in a combo box are numbered beginning with zero, just like listboxes. However, if an error occurs, <TT>CB_ERR</TT> is returned instead of <TT>LB_ERR</TT>.If an item cannot be added due to insufficient space, <TT>CB_ERRSPACE</TT> is returned.</P><P>To determine the number of items currently in a combo box, <TT>CComboBox</TT>includes the <TT>GetCount</TT> member function:</P><PRE><FONT COLOR="#0066FF"><TT>nItems = comboBox.GetCount();</TT></FONT></PRE><P>Remember, <TT>CB_ERR</TT> is returned instead of <TT>LB_ERR</TT> when using a<TT>CComboBox</TT> object.<H4><FONT COLOR="#000077">Collecting Input from a Combo Box</FONT></H4><P>You can collect input from a combo box by using the <TT>GetWindowText</TT> memberfunction, just like an edit control. For simple combo boxes and drop-down combo boxes,this is the easiest way to get the current selection. You can also use the <TT>GetCurSel</TT>member function to determine the current selection position from the list box.<H3><FONT COLOR="#000077"><B>A Combo Box Example</B></FONT></H3><P>To create a sample project using a combo box and the <TT>CComboBox</TT> class,follow these steps:<DL>	<DD>1. Create a dialog box-based project named <TT>ComboList</TT> using AppWizard,	as described in previous examples.<BR>	<BR>	2. Add a drop-down combo list to the <TT>IDD_COMBOLIST_DIALOG</TT> resource, as you	did for the list box earlier in this hour.<BR>	<BR>	3. Give the combo box the resource ID <TT>IDC_COMBO</TT>. Use the default values	for all other properties.<BR>	<BR>	4. Add a static-text control to the dialog box, and give it the resource ID <TT>IDC_RESULT</TT>.	This text control will be used to display information about messages received from	the combo box.<BR>	<BR>	5. Using ClassWizard, add a member variable to the <TT>CComboListDlg</TT> class named	<TT>m_comboList</TT>. Set the Category to Control.<BR>	<BR>	6. Using ClassWizard, add a message-handling function for the IDOK control <TT>BN_CLICKED</TT>	message to the <TT>CComboListDlg</TT> class.<BR>	<BR>	7. Using ClassWizard, add message-handling functions for <TT>IDC_COMBO</TT> control	messages to the <TT>CComboListDlg</TT> class. Add functions to handle <TT>CBN_CLOSEUP</TT>	and <TT>CBN_EDITUPDATE</TT> messages.</DL><H4><FONT COLOR="#000077">Adding Strings to a Combo Box</FONT></H4><P>After completing these steps, add the source code in Listing 7.6 to the <TT>CComboListDlg::OnInitDialog</TT>member function. This code adds three entries to the combo box. There are alreadyseveral lines of code in the function; don't remove them. Just add the code fromListing 7.6 after the <TT>//TODO</TT> comment provided by AppWizard.<H4><FONT COLOR="#000077">TYPE: Listing 7.6. Source code added to the CComboListDlg::OnInitDialogfunction.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>// In OnInitDialog...</TT><TT>// TODO: Add extra initialization here</TT><TT>    m_comboList.AddString( &quot;Foo&quot; );</TT><TT>    m_comboList.AddString( &quot;Bar&quot; );</TT><TT>    m_comboList.AddString( &quot;Baz&quot; );</TT></FONT></PRE><H4><FONT COLOR="#000077">Getting the Current Combo Box Selection</FONT></H4><P>Edit the <TT>CComboListDlg::OnOK</TT> member function so it looks like the sourcecode provided in Listing 7.7. This code uses member functions from the <TT>CComboBox</TT>class to display information about the current combo box selection.<H4><FONT COLOR="#000077">TYPE: Listing 7.7. Source code added to the CComboListDlg::OnOKfunction.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CComboListDlg::OnOK()</TT><TT>{</TT><TT>    CString szCombo;</TT><TT>    m_comboList.GetWindowText( szCombo );</TT><TT>    AfxMessageBox( szCombo );</TT><TT>    int nChoice = m_comboList.GetCurSel();</TT><TT>    szCombo.Format( &quot;The current selection is %d&quot;, nChoice );</TT><TT>    AfxMessageBox( szCombo );</TT><TT>    CDialog::OnOK();</TT><TT>}</TT></FONT></PRE><H4><FONT COLOR="#000077">Detecting Combo Box Events</FONT></H4><P>Add the source code provided in Listing 7.8 to the <TT>CComboListDlg::OnCloseupCombo</TT>function. When the <TT>CBN_CLOSEUP</TT> message is received, a message is displayedon the static-text control <TT>IDC_RESULT</TT>.<H4><FONT COLOR="#000077">TYPE: Listing 7.8. Source code added to the CComboListDlg::OnCloseupCombofunction.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CComboListDlg::OnCloseupCombo()</TT><TT>{</TT><TT>    CString     szChoice;</TT><TT>    CString     szResult;</TT><TT>    int         nChoice;</TT><TT>    // Get current selections from edit and list-box controls</TT><TT>    m_comboList.GetWindowText( szChoice );</TT><TT>    nChoice = m_comboList.GetCurSel();</TT><TT>    if( nChoice != CB_ERR )</TT><TT>    {</TT><TT>        // If a valid choice was made from the list box, fetch</TT><TT>        // the item's text string.</TT><TT>        m_comboList.GetLBText( nChoice, szChoice );</TT><TT>        szResult = &quot;Closing after selecting &quot; + szChoice;</TT><TT>    }</TT><TT>    else if( szChoice.IsEmpty() == TRUE )</TT><TT>    {</TT><TT>        // No choice was made from the list box, and the edit</TT><TT>        // control was empty.</TT><TT>        szResult = &quot;No choice selected&quot;;</TT><TT>    }</TT><TT>    else if( m_comboList.FindStringExact(-1, szChoice) != CB_ERR )</TT><TT>    {</TT><TT>        // The string from the edit control was found in the</TT><TT>        // list box.</TT><TT>        szResult = &quot;Closing after selecting &quot; + szChoice;</TT><TT>    }</TT><TT>    else</TT><TT>    {</TT><TT>        // The edit control contains a new string, not currently</TT><TT>        // in the list box. Add the string.</TT><TT>        m_comboList.AddString( szChoice );</TT><TT>        szResult = &quot;Adding &quot; + szChoice + &quot; to list&quot;;</TT><TT>    }</TT><TT>    // Get a pointer to the static-text control, and display an</TT><TT>    // appropriate result message.</TT><TT>    CWnd* pWnd = GetDlgItem( IDC_RESULT );</TT><TT>    ASSERT( pWnd );</TT><TT>    if( pWnd )</TT><TT>        pWnd-&gt;SetWindowText( szResult );</TT><TT>}</TT></FONT></PRE><P>The <TT>CComboListDlg::OnCloseupCombo</TT> function collects the contents fromthe edit control section of the combo box and the selected item from the list boxsection of the combo box. If a selection has been made in the list box, the item'sstring is retrieved and displayed. Otherwise, if a string was entered in the editcontrol, it is displayed. The string is not currently in the list box; it is addedto it.</P><P>Add the source code provided in Listing 7.9 to the <TT>CComboListDlg::OnEditupdateCombo</TT>member function. <TT>CBN_EDITUPDATE</TT> is received when the user types inside theedit control. When the <TT>CBN_EDITUPDATE</TT> message is received, the contentsof the edit control are displayed on the <TT>IDC_RESULT</TT> text control.<H4><FONT COLOR="#000077">TYPE: Listing 7.9. Source code added to the CComboListDlg::OnEditupdateCombofunction.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>void CComboListDlg::OnEditupdateCombo()</TT><TT>{</TT><TT>    CString     szChoice;</TT><TT>    CString     szResult;</TT><TT>    m_comboList.GetWindowText( szChoice );</TT><TT>    szResult = &quot;Choice changed to &quot; + szChoice;</TT><TT>    CWnd* pWnd = GetDlgItem( IDC_RESULT );</TT><TT>    ASSERT( pWnd );</TT><TT>    if( pWnd )</TT><TT>        pWnd-&gt;SetWindowText( szResult );</TT><TT>}</TT></FONT></PRE><P>Compile and run the ComboList project. Experiment by adding new entries to thecombo box and by expanding and closing the combo box. Other messages sent to thecombo box can be trapped and displayed just as <TT>CBN_EDITUPDATE</TT> was handledin Listing 7.9.<H2><FONT COLOR="#000077"><B>Summary</B></FONT></H2><P>In this hour, you learned about list box and combo box controls and how they areused in Windows programs. You also learned how to associate these controls with <TT>CListBox</TT>and <TT>CComboBox</TT> objects.<H2><FONT COLOR="#000077"><B>Q&amp;A</B></FONT></H2><DL>	<DD><B>Q What is the easiest way to create a list box that has a bitmap image next	to each item?</B><BR>	<BR>	<B>A</B> The only way to display a bitmap in a list box is to create an owner-drawn	list box, where you take responsibility for drawing each item in the list box. You	can easily achieve a similar effect by using a list view control, which is discussed	in Hour 18, &quot;List View Controls.&quot;<BR>	<BR>	<B>Q When should I use a combo box drop list, and when is a list box more appropriate?</B><BR>	<BR>	<B>A</B> A drop list is appropriate when space on your dialog box is at a premium.	A list box is more appropriate when the user must see more than one item without	clicking on the control.</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. Which MFC class is used to manage list box controls?<BR>	<BR>	2. What message is sent to your dialog box when a user double-clicks a dialog box?<BR>	<BR>	3. What functions are used to add items to a list box control?<BR>	<BR>	4. What function is used to retrieve the number of items in a list box control?<BR>	<BR>	5. What function is used to retrieve the currently selected index in a list box?<BR>	<BR>	6. What are the three styles used for list box controls?<BR>	<BR>	7. What are the three types of loops used in C++ programs?<BR>	<BR>	8. Which MFC class is used to manage combo boxes?<BR>	<BR>	9. What function is used to add an item to a combo box at a specific index?<BR>	<BR>	10. What are the three styles used for combo boxes?</DL><H3><FONT COLOR="#000077"><B>Exercise</B></FONT></H3><DL>	<DD>1. Modify the ListBox project by adding a new button labeled Loop. When a user	clicks the Loop button, display each item in the list box in a message box, one item	at a time.<FONT COLOR="#000077"></FONT></DL><CENTER><P><HR><A HREF="../ch06/ch06.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch08/ch08.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>&#169; <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一区二区三区免费野_久草精品视频
日本不卡一区二区| 国产一区二区三区久久久 | 色婷婷综合久久久中文一区二区 | 色域天天综合网| 国产自产2019最新不卡| 亚洲成a人片综合在线| 国产精品私人影院| 久久久久久免费毛片精品| 欧美久久免费观看| 色婷婷国产精品| 丁香网亚洲国际| 精品一区二区久久久| 偷窥少妇高潮呻吟av久久免费| 国产精品久久久久久福利一牛影视| 欧美一区二区三区日韩| 欧美性猛片xxxx免费看久爱 | 欧美一级片在线| 欧美日韩中文字幕一区| 91福利社在线观看| 91亚洲精华国产精华精华液| 国产精品一区二区视频| 极品瑜伽女神91| 精品一区二区三区久久| 日韩 欧美一区二区三区| 亚洲午夜免费福利视频| 亚洲精品午夜久久久| 国产精品国产三级国产aⅴ入口| 2023国产精品| 2023国产精华国产精品| 精品日韩欧美在线| 26uuu成人网一区二区三区| 日韩一级在线观看| 日韩一级在线观看| 精品国产伦一区二区三区观看方式 | 在线一区二区视频| 欧美在线视频你懂得| 日本福利一区二区| 欧美午夜影院一区| 欧美猛男男办公室激情| 制服丝袜亚洲播放| 日韩视频一区在线观看| 精品久久国产字幕高潮| 精品国产一区二区三区忘忧草 | 精品久久一区二区三区| 精品国内二区三区| 欧美激情资源网| 国产精品亲子乱子伦xxxx裸| 最新日韩av在线| 一区二区三区不卡视频在线观看 | 欧美不卡在线视频| 欧美一级淫片007| 欧美哺乳videos| 久久蜜臀中文字幕| 国产精品家庭影院| 一区二区三区视频在线看| 一区二区三区在线高清| 偷窥国产亚洲免费视频| 久草中文综合在线| 成人精品在线视频观看| 91国产视频在线观看| 91精品国产免费| 国产天堂亚洲国产碰碰| 国产精品成人网| 午夜精品久久久久久久久| 免费欧美日韩国产三级电影| 国产精品77777竹菊影视小说| av中文字幕亚洲| 欧美亚洲尤物久久| 2020国产精品自拍| 亚洲欧美激情视频在线观看一区二区三区 | 亚洲欧洲精品天堂一级| 亚洲国产精品一区二区久久| 久久精品久久久精品美女| 国产91精品欧美| 欧美日本韩国一区| 国产精品视频yy9299一区| 亚洲国产日日夜夜| 国产精品一区2区| 日本高清免费不卡视频| 精品91自产拍在线观看一区| 亚洲欧美国产高清| 精品一区二区三区香蕉蜜桃 | 国产伦精品一区二区三区免费| 成人av在线影院| 69堂成人精品免费视频| 国产精品国模大尺度视频| 肉肉av福利一精品导航| av中文字幕亚洲| 精品成人在线观看| 亚洲一区二区三区不卡国产欧美| 国产精品一区二区在线观看不卡| 欧美午夜精品电影| 国产精品欧美精品| 久久99久久久久久久久久久| 一本大道久久a久久精二百| 精品国产乱码91久久久久久网站| 樱桃国产成人精品视频| 成人综合婷婷国产精品久久| 日韩欧美一二三区| 亚洲成人免费电影| 色偷偷一区二区三区| 国产天堂亚洲国产碰碰| 美女脱光内衣内裤视频久久网站 | 欧美一区二区成人6969| 亚洲欧美日韩国产综合| 国产精品系列在线观看| 欧美一区二区在线观看| 亚洲国产精品久久一线不卡| 99久久精品久久久久久清纯| 久久久久国产精品厨房| 久久电影网站中文字幕| 91精品国产色综合久久ai换脸 | www成人在线观看| 日产欧产美韩系列久久99| 在线观看免费视频综合| 1区2区3区欧美| www.日韩大片| 国产女主播视频一区二区| 精品一区二区影视| 欧美成人激情免费网| 日韩电影免费在线观看网站| 9191成人精品久久| 亚洲国产毛片aaaaa无费看 | a美女胸又www黄视频久久| 国产欧美精品在线观看| 国产福利一区在线| 久久久综合九色合综国产精品| 日本午夜一本久久久综合| 欧美久久久一区| 日本中文字幕不卡| 日韩三级视频在线观看| 免费黄网站欧美| 精品国产麻豆免费人成网站| 久久成人18免费观看| 久久女同互慰一区二区三区| 国产精品一二三四区| 亚洲国产激情av| av成人老司机| 一区二区免费看| 欧美日韩一区中文字幕| 丝袜国产日韩另类美女| 日韩女优av电影| 国产精品一品二品| 中文字幕欧美一| 欧洲精品一区二区三区在线观看| 亚洲自拍偷拍网站| 91麻豆精品国产无毒不卡在线观看 | 精品亚洲成av人在线观看| 欧美sm极限捆绑bd| 国产成人av影院| 国产精品国产三级国产普通话99| 91视视频在线观看入口直接观看www | 国产乱子轮精品视频| 亚洲国产成人私人影院tom | 26uuu国产一区二区三区| 成人性生交大片免费看中文| 日韩毛片精品高清免费| 欧美亚洲综合久久| 青草国产精品久久久久久| 久久久久88色偷偷免费| 91免费版pro下载短视频| 亚洲一区二区在线观看视频| 日韩欧美一级片| 成人免费精品视频| 午夜视频久久久久久| 精品福利一二区| 色婷婷国产精品| 久久99久久99精品免视看婷婷 | 日本乱码高清不卡字幕| 日韩高清不卡一区二区| 国产清纯白嫩初高生在线观看91| 色先锋资源久久综合| 经典三级视频一区| 亚洲精品欧美激情| 久久综合九色综合欧美就去吻| 成人h动漫精品一区二区| 午夜不卡av在线| 国产精品乱码一区二三区小蝌蚪| 欧美精选在线播放| 懂色一区二区三区免费观看| 亚洲444eee在线观看| 国产精品天美传媒| 日韩欧美一级二级三级| 91美女精品福利| 国产一区二区三区| 亚洲国产日韩综合久久精品| 国产日韩欧美高清在线| 9191国产精品| 色哟哟在线观看一区二区三区| 久久激五月天综合精品| 伊人一区二区三区| 欧美激情一二三区| 日韩视频免费观看高清完整版 | 国产精品你懂的| 亚洲精品一区二区在线观看| 在线免费视频一区二区| 成人性生交大合| 久久精工是国产品牌吗| 午夜电影网亚洲视频| 亚洲自拍偷拍网站|