添加工具条

本文介绍在MFC框架中如何创建并显示工具栏,包括使用代码实现工具栏的创建、加载预定义的工具栏资源及显示设置等。此外还讲解了如何通过RepositionBars方法重新定位和调整窗口内控件栏的位置。
 //添加工具条
 if (!m_wndtoolbar.CreateEx(this,TBSTYLE_FLAT,  WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS ,
        CRect(4,4,0,0)) || !m_wndtoolbar.LoadToolBar(IDR_TOOLBAR))
 {
  MessageBox("创建工具栏失败!", "错误", MB_ICONSTOP);
  return FALSE;
 }

 m_wndtoolbar.ShowWindow(SW_SHOW);
 RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);

CWnd::RepositionBars

This method repositions and resizes control bars in the client area of a window. The nIDFirst and nIDLast parameters define a range of control-bar identifiers to be repositioned in the client area. The nIDLeftOver parameter specifies the identifier of the child window, usually the view, which is repositioned and resized to fill the rest of the client area not filled by control bars.

转载于:https://www.cnblogs.com/rrll/archive/2011/08/10/2134043.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值