⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_27117.htm

📁 一些关于vc的问答
💻 HTM
字号:
<p>
序号:27117 发表者:听雨舟 发表日期:2003-01-08 16:18:16
<br>主题:高手帮忙看一下,下段代码中为何要用SetButtonInfo
<br>内容:int MainFrame::CreateMyToolBar()<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;#define COMBO_BOX_WIDTH 80 //the width of the combo box<BR>&nbsp;&nbsp;&nbsp;&nbsp;//set up the ComboBox control as a select box<BR>//First get the index of the button's<BR> position in the toolbar<BR>int index = 0;<BR>CRecr rect;<BR>while(m_wndToolBar.GetItemID(index)!<BR>= ID_MY_COMBO_BOX) index++;<BR>//next convert that button to a <BR>seperator and get its position<BR>m_wndToolBar.SetButtonInfo(index,<BR> ID_MY_COMBO_BOX, TBBS_SEPARATOR, COMBO_BOX_WIDTH);<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.GetItemRect(index, &amp;rect);<BR>//expand the rectangle to allow the <BR>combo box room to drop down<BR>&nbsp;&nbsp;&nbsp;&nbsp;rect.top+=2;<BR>&nbsp;&nbsp;&nbsp;&nbsp;rect.bottom += 200;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// then .Create the combo box and show it<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (!m_wndToolBar.m_ wndMyComboBox.Create(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WS_CHILD|WS_VISIBLE | CBS_AUTOHSCROLL | <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CBS_DROPDOWNLIST | CBS_HASSTRINGS ,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rect, &amp;m_wndToolBar, IDC_MY_COMBO))<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TRACE0("Failed to create combo-box\n");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return FALSE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.ShowWindow(SW_SHOW);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//adding string to the combo box<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.AddString("Fisrt Select");<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.AddString("Second Select");<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.AddString("Third Select");<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.AddString("Fourth Select");<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.AddString("Fifth Select");<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_wndToolBar.m_wndMyComboBox.SetCurSel(0);<BR>}<BR><BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:石松 回复日期:2003-01-08 19:08:53
<br>内容:这段代码的目的是为了将组合框加入工具栏,用SetButtonInfo的目的是为了分析在组合框前是否有分隔符!因为有分隔符和没有分隔符所占的位置大小是不同的。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -