combo_in_flatbar.shtml

来自「mfc资源大全包含MFC编程各个方面的源码」· SHTML 代码 · 共 50 行

SHTML
50
字号
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="Author" CONTENT="Zafir Anjum">
   <TITLE>Toolbar - Using ComboBox on a Flat Toolbar</TITLE>
</HEAD>
<body background="../fancyhome/back.gif" bgcolor="#FFFFFF" link="#B50029" vlink="#8E2323" alink="#FF0000" bgproperties="fixed">
<table WIDTH="100%">
<tr WIDTH="100%">
<td align=center><!--#exec cgi="/cgi/ads.cgi"--><td>
</tr>
</table>


<CENTER><H3><FONT COLOR="#AOAO99">Using ComboBox on a Flat Toolbar</FONT></H3></CENTER>
<HR>




This article was contributed by <A HREF="mailto:cartek@prodigy.net">Kenneth Carter</A>.


<P>This was tricky i spent week and a half on this but I solved it by
studying the messages that a combobox gives off.
I want to thank joerg for helping me get the combobox on the toolbar
this class was written to take advantage of th CToolBarEx as a base
class that Joerg had contributated.

<P>There is a message CBN_SELENDOK that is immediatly posted before
CBN_SELCHANGE.

<P>Using these two messages and a static variable you can pass the current
sel that you selected to class outside of the Combobar class. the nice
thing is that the api handles the setting the focus correctly.

<P>Here is some code on how it was down.

<P>combobar.cpp

<PRE><TT><FONT COLOR="#990000">
BEGIN_MESSAGE_MAP(CComboBar, CToolBarEx)
//{{AFX_MSG_MAP(CComboBar)
ON_CBN_SELENDOK(IDW_TOOLCOMBO, OnSelEndOk)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

BOOL CComboBar::Create(CFrameWnd * pParent, UINT nID, UINT nComboID,
					   const int nWidth,
					   

⌨️ 快捷键说明

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