CMFCToolBar定制问题

CMFCToolBar定制问题

本文介绍了CMFCToolBar定制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.我在将较旧的应用程序升级到新的MFC时遇到了一些问题.看完所有地方之后,我似乎仍然无法重新创建所需的工具栏.

我有一个MDI应用程序,带有MenuBar和标准ToolBar,并且我想为文本创建一个附加的CMFCToolBar.格式化,包括CMFCToolBarFontComboBox,CMFCToolBarComboBox和其他类型的按钮.

为简化起见,让我们考虑添加CMFCToolBarFontComboBox.

我的问题:

Hi. I'm having a few problems upgrading an older application to the new MFC. After reading all over the place, I still can't seem to recreate the toolbar I need.

I have an MDI application, with the MenuBar and the standard ToolBar, and I want to create an additional CMFCToolBar for text formating, which includes a CMFCToolBarFontComboBox, a CMFCToolBarComboBox and other type of buttons.

To make things simpler, let's just think about adding the CMFCToolBarFontComboBox.

My problem:

环顾四周后,这是我发现的最明智的方法,但仍然无法正常工作.

我创建了CMainFrame创建函数中的其他工具是这样的:(m_wndTextBar是CMFCTextToolBar,它扩展了CMFCToolBar)

After looking around, this is the most sensible way I found to do this, but it still doesn't work.

I create the additional tool in the CMainFrame create function like this: (m_wndTextBar is a CMFCTextToolBar, which extends CMFCToolBar)

如果(!m_wndTextBar.CreateEx(this,TBSTYLE_FLAT,WS_CHILD | WS_VISIBLE CBRS_TOP CBRS_GRIPPER CBRS_TOOLTIPS CBRS_FLYBY CBRS_SIZE_DYNAMIC)||
!! m_wndTextBar.LoadToolBar (IDR_TEXTTOOLBAR_​​256))
{
TRACE0(无法创建文本工具栏\ n");
返回FALSE; //创建失败
}
m_wndTextBar.SetWindowText(_T(" Format")));
if (!m_wndTextBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 
    !m_wndTextBar.LoadToolBar(IDR_TEXTTOOLBAR_256)) 
    TRACE0("Failed to create text toolbar\n"); 
    return FALSE;      // fail to create 
m_wndTextBar.SetWindowText(_T("Format")); 

推荐答案

m_wndTextBar.SetWindowText(_T("Format")));

m_wndTextBar.SetWindowText(_T("Format")); 


这篇关于CMFCToolBar定制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 01:03