📄 subject_27117.htm
字号:
<p>
序号:27117 发表者:听雨舟 发表日期:2003-01-08 16:18:16
<br>主题:高手帮忙看一下,下段代码中为何要用SetButtonInfo
<br>内容:int MainFrame::CreateMyToolBar()<BR>{<BR> #define COMBO_BOX_WIDTH 80 //the width of the combo box<BR> //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> m_wndToolBar.GetItemRect(index, &rect);<BR>//expand the rectangle to allow the <BR>combo box room to drop down<BR> rect.top+=2;<BR> rect.bottom += 200;<BR> // then .Create the combo box and show it<BR> if (!m_wndToolBar.m_ wndMyComboBox.Create(<BR> WS_CHILD|WS_VISIBLE | CBS_AUTOHSCROLL | <BR> CBS_DROPDOWNLIST | CBS_HASSTRINGS ,<BR> rect, &m_wndToolBar, IDC_MY_COMBO))<BR> {<BR> TRACE0("Failed to create combo-box\n");<BR> return FALSE;<BR> }<BR> m_wndToolBar.m_wndMyComboBox.ShowWindow(SW_SHOW);<BR> //adding string to the combo box<BR> m_wndToolBar.m_wndMyComboBox.AddString("Fisrt Select");<BR> m_wndToolBar.m_wndMyComboBox.AddString("Second Select");<BR> m_wndToolBar.m_wndMyComboBox.AddString("Third Select");<BR> m_wndToolBar.m_wndMyComboBox.AddString("Fourth Select");<BR> m_wndToolBar.m_wndMyComboBox.AddString("Fifth Select");<BR> 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 + -