windows libcoap安装文件怎么安装

创建扩展组合框 (Extended Combo Box) 控件 (MFC)
创建扩展组合框 (Extended Combo Box) 控件
创建扩展组合框 (Extended Combo Box) 控件
Visual Studio .NET 2003
创建扩展组合框 (Extended Combo Box) 控件的方式取决于是在对话框中使用该控件还是在非对话框窗口中创建此控件。 直接在对话框中使用 CComboBoxEx
在对话框编辑器中,将“Extended Combo Box”控件添加到对话框模板资源。指定其控件 ID。 使用扩展组合框 (Extended Combo Box) 控件的“属性”对话框指定任何所需样式。 使用添加带 Control 属性的 CComboBoxEx 类型的成员变量。可以使用此成员调用 CComboBoxEx 成员函数。 对于任何需要处理的扩展组合框 (Extended Combo Box) 控件通知消息,使用“属性”窗口在对话框类中映射处理函数(请参见)。 在 OnInitDialog 中为 CComboBoxEx 对象设置任何附加样式。
在非对话框窗口中使用 CComboBoxEx
在视图或窗口类中定义此控件。 调用控件的 Create 成员函数,可能在 OnInitialUpdate 中,也可能与父窗口的 OnCreate 处理函数一样早。设置此控件的样式。
此页面有帮助吗?
更多反馈?
1500 个剩余字符
我们非常感谢您的反馈。Place Combo Box, Edit Box, Progress Control, Check Box on toolbar, CComboBox, CEdit, CCheckBox, VC++ MFC Example
The Case Of UCanCode.net& Release The Power
OF& Visual C++ !
E-XD++Visual
C++/ MFC Products
COM Products
Get Ready to Unleash the
Power of UCanCode .NET
Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database
workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!
&100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!&
MFC Example: Place
Combo Box, Edit Box, Progress Control, Check Box
on toolbar, CComboBox, CEdit, CCheckBox
&By Randy More.&
place combo-boxes,
edit boxes,
controls, etc. into
It is very easy (once
you see how it is done) to place
combo-boxes, edit
boxes, progress
controls, etc. into
toolbars. Below are two examples
of this, in the first a ComboBox
is placed on
a toolbar, and in
the second a cluster of checkboxes
is added. In both cases the technique is the same:
Step 1: Place
a button on
the toolbar in the
spot where you want the control(s) to eventually be. YOU
MUST place a seperator on either side of the button!.
Give the button an easily remembered resource name such
as IDP_PLACEHOLDER2 in the example
Step 2: Derive a
class from CToolBar
and give it a member variable for the control you will
be creating. For the ComboBox
example that class
looks like this. No extra methods are required, just a
place for the instance of the control to live.
class CMainToolBar : public CToolBar
CComboBox m_wndS
Step 3: In your
main frame's .h file replace the instance of the CToolBar
with you new class. Be sure to add an include statement
for the class definition created in step 1.
protected:
CStatusBar m_wndStatusB
CMainToolBar m_wndToolB
Step 4: At the
end of your main frame's OnCreate method you replace the
placeholder button with your control as follows:
int SMCMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
#define SNAP_WIDTH 80 //the width of the combo box
index = 0;
while (m_wndToolBar.GetItemID(index) != IDP_PLACEHOLDER2) index++;
m_wndToolBar.SetButtonInfo(index, IDP_PLACEHOLDER2, TBBS_SEPARATOR,
SNAP_WIDTH);
m_wndToolBar.GetItemRect(index, &rect);
rect.top+=2;
rect.bottom += 200;
if (!m_wndToolBar.m_wndSnap.Create(WS_CHILD|WS_VISIBLE|CBS_AUTOHSCROLL|
CBS_DROPDOWNLIST|CBS_HASSTRINGS,
rect, &m_wndToolBar, IDC_SNAP_COMBO))
TRACE0(&Failed to create combo-box\n&);
return FALSE;
m_wndToolBar.m_wndSnap.ShowWindow(SW_SHOW);
m_wndToolBar.m_wndSnap.AddString(&SNAP OFF&);
m_wndToolBar.m_wndSnap.AddString(&SNAP GRID&);
m_wndToolBar.m_wndSnap.AddString(&SNAP RASTER&);
m_wndToolBar.m_wndSnap.AddString(&SNAP VERTEX&);
m_wndToolBar.m_wndSnap.AddString(&SNAP LINE&);
m_wndToolBar.m_wndSnap.SetCurSel(0);
The result looks like
Here is one that is a
little trickier:
Four check
boxes are placed in the toolbar.
In addition to adding multiple controls in place of a
single button this example
shows how to change the font of the checkboxes.
1. Derive the new
toolbar class and add it to the main frame. Also add a
CFont called gSmallFont to the Main Frame.
class CCoupleToolBar : public CToolBar
CButton m_wndC
CButton m_wndE
CButton m_wndT
CButton m_wndZ
a placeholder button on
the toolbar resource
MAKING SURE to leave a space on either side. This is
done just as in the first example.
3. At the end of
OnCreate in the main frame, first set up the font we are
going to use, then replace the placeholder button with
the new controls.
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
CClientDC DC(GetDesktopWindow());
long logical_pixels = DC.GetDeviceCaps(LOGPIXELSX);
if(logical_pixels &100)
gSmallFont.CreatePointFont(67, &DEFAULT&, NULL);
gSmallFont.CreatePointFont(50, &DEFAULT&, NULL);
#define CHECK_WIDTH 94
CRect safe_
index = 0;
while (m_wndViewBar.GetItemID(index) != IDP_PLACHOLDER) index++;
m_wndViewBar.SetButtonInfo(index, IDP_PLACHOLDER, TBBS_SEPARATOR,
CHECK_WIDTH);
m_wndViewBar.GetItemRect(index, &rect);
safe_rect=
rect.left +=2;
rect.right=rect.left + ((CHECK_WIDTH / 2)-4);
rect.top=2;
rect.bottom=rect.top + 10;
if (!m_wndViewBar.m_wndCenter.Create(&CNTR&,
BS_CHECKBOX|WS_CHILD|WS_VISIBLE, rect, &m_wndViewBar,
IDM_COUPLE))
TRACE0(&Failed to create CENTER check-box\n&);
return FALSE;
m_wndViewBar.m_wndCenter.SendMessage(WM_SETFONT,
(WPARAM)HFONT(gSmallFont),TRUE);
rect.top = rect.bottom += 2;
rect.bottom = rect.top + 10;
if (!m_wndViewBar.m_wndEdge.Create(&EDGE&,
BS_CHECKBOX|WS_CHILD|WS_VISIBLE, rect, &m_wndViewBar,
IDM_COUPLE_EDGE))
TRACE0(&Failed to create EDGE check-box\n&);
return FALSE;
m_wndViewBar.m_wndEdge.SendMessage(WM_SETFONT,
(WPARAM)HFONT(gSmallFont), TRUE);
rect = safe_
rect.left += ((CHECK_WIDTH / 2) + 4);
rect.top = 2;
rect.bottom = rect.top + 10;
if (!m_wndViewBar.m_wndZoom.Create(&ZOOM&,
BS_CHECKBOX|WS_CHILD|WS_VISIBLE, rect, &m_wndViewBar,
IDM_LOCK_ZOOMS))
TRACE0(&Failed to create ZOOM check-box\n&);
return FALSE;
m_wndViewBar.m_wndZoom.SendMessage(WM_SETFONT,
(WPARAM)HFONT(gSmallFont),TRUE);
rect.top = rect.bottom += 2;
rect.bottom = rect.top + 10;
if (!m_wndViewBar.m_wndTrack.Create(&TRKR&,
BS_CHECKBOX|WS_CHILD|WS_VISIBLE, rect, &m_wndViewBar,
IDM_SHOW_TRACKING))
TRACE0(&Failed to create EDGE check-box\n&);
return FALSE;
m_wndViewBar.m_wndTrack.SendMessage(WM_SETFONT,
(WPARAM)HFONT(gSmallFont), TRUE);
Copyright ? UCanCode.Net Software
, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.
Please direct your questions or comments to252627282930311234567891011121314151617181920212223242527282930311234
随笔 - 152
评论 - 113
本博客原创文章,欢迎转载和交流。不过请注明以下信息:
作者:TimWu
来源:/Tim
感谢您对我的支持!
随笔分类(166)
积分与排名
阅读排行榜

我要回帖

更多关于 libcoap 的文章

 

随机推荐