BCG界面库_如何用vc设计界面

BCG界面库_如何用vc设计界面BCGControlBarLibraryProfessionalEdition installation:整个库的源代码安装在\BCGCBPro 目录下面.可执行文件(*.dll)安装在\Bin (forVisualStudio6.0)或\Bin7 (forVisualStudio.NET)下面。请在你的源代码中做如下的改变:在应用程序的Inc

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

BCGControlBar Library Professional Edition installation:

整个库的源代码安装在<install dir>\BCGCBPro 目录下面.可执行文件(*.dll)安装在 <install dir>\Bin (for VisualStudio 6.0) 或<install dir>\Bin7 (for VisualStudio .NET)下面。

请在你的源代码中做如下的改变:

  • 在应用程序的Include路径中加入BCGCBPro目录,具体添加办法如下:vs2005下面打开菜单工具的Option项,选择项目解决方案-〉vc++目录,然后将包含文件<install dir>\BCGCBPro 添加进去。
  • 确信在你的应用程序的 InitInstance() 方法中调用了AfxOleInit() 。
  • 在stdafx.h中加入下面的包含文件:
#include “BCGCBProInc.h”
class CMyApp : public CWinApp,
                         public CBCGPWorkspace
  • 第一步,你需要定义一个在注册表里保存个性化数据的项并且鼠标,键盘和上下文菜单都需要。为了实现这一点,CMyApp::InitInstance set registry entry and initialize customization managers:
SetRegistryBase (_T(“Settings“));

// Initialize customization managers:
InitMouseManager();
InitContextMenuManager();
InitKeyboardManager();

  • 如果你决定使你的鼠标和菜单具有个性化,你需要 “attach” 一个需要的视图初始化鼠标和菜单的个性化管理。重载CBCGPWorkspace::PreLoadState 方法:
class CMyApp ….
{


virtual void
 PreLoadState();

};

void CMyApp::PreLoadState()
{

   
 // Associate mouse event with specific view(s):

    GetMouseManager()->AddView (iIdTestView, _T(“
Test view“), IDR_VIEW);

    // Initialize context menus:
    GetContextMenuManager()->AddMenu (_T(“
Test menu“), idMenu); 
}

  • 把框架文件中的基类CMDIFrameWnd 改为 CBCGPMDIFrameWnd (in case of SDI application changeCFrameWnd to CBCGPFrameWnd)
  • 将子框架的基类 CMDIChildWnd 改为  CBCGPMDIChildWnd
  • 将 CToolbar 改为 CBCGPToolBar 并且加入一个embedded menu bar 在你的CMainFrame类中:
CBCGPMenuBar    m_wndMenuBar;    // New menu bar
CBCGToolBar      m_wndToolBar;     
 // Application toolbar
  • CMainFrame::OnCreate() 方法中加入下面几行以实现菜单的功能:
// Create menu bar (replaces the standard menu):
if (!m_wndMenuBar.Create (this))
{

      TRACE0(“Failed to create menubar\n”);
      return -1;     
 // fail to create
}

m_wndMenuBar.SetBarStyle (m_wndMenuBar.GetBarStyle() |
                                          CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

  • 加入以下代码以实现ca:
m_wndMenuBar.EnableDocking (CBRS_ALIGN_ANY);
DockControlBar (&m_wndMenuBar);

Important:在你的应用程序中,你可以使用多个 CBCGPToolBar .所用工具条的图像将自动合并到一张位图上 . 但是只有一个CBCGPMenuBar 对象可以使用.
 

为了具有自定义工具条和菜单条, 请做如下改变:

  • 加入 toolbar/menu customization command (for example, View | Customize…)
  • Implement OnViewCustomize method. The code will look something like this:
void CMainFrame::OnViewCustomize()
{

 // Create a customize toolbars dialog:

 CBCGPToolbarCustomize* pDlgCust = new CBCGToolbarCustomize (this,
TRUE
 );

 // Add predefined toolbars:
 pDlgCust->AddToolBar (“Main”, IDR_MAINFRAME);
 ….

 // Add user-defined commands:
 pDlgCust->AddButton (“User”, CBCGPToolbarButton (ID_USER_TOOL1, 1, “User Tool 1”, TRUE));
 pDlgCust->AddButton (“User”, CBCGToolbarButton (ID_USER_TOOL2, 2, “User Tool 2”, TRUE));
 pDlgCust->AddButton (“User”, CBCGToolbarButton (ID_USER_TOOL3, 3, “User Tool 3”, TRUE));
 ….

 pDlgCust->SetUserCategory (“User”);

 // Enable Create/Delete of the user-defined toolbars:
 pDlgCust->EnableUserDefinedToolbars ();

 pDlgCust->Create ();
}

为了能具有 Microsofte Office 2000 的菜单风格:

  • Define your own basic commands set (usually in CMainFrame::OnCreate()):
CList<UINT, UINT> lstBasicCoomads;
 

lstBasicCoomads.AddTail (ID_FILE_NEW);
lstBasicCoomads.AddTail (ID_FILE_OPEN);
lstBasicCoomads.AddTail (ID_FILE_SAVE);

……
lstBasicCoomads.AddTail (ID_APP_ABOUT);

CBCGPToolBar::SetBasicCommands (lstBasicCoomads);

  • 这些命令将使得这些菜单能保持常见.

使菜单项是否具有阴影的风格:

CBCGPMenuBar::EnableMenuShadows (BOOL bEnable = TRUE)

Note: please don’t use menu shadows if your views content may be dynamically changed when the popup menu is shown (e.g., views shows animation, HTML page). In this case menu shadow “is remember” the previous view image.

在运行时改变菜单的字体:

CBCGPMenuBar::SetMenuFont (LPLOGFONT lpLogFont, BOOL bHorz = TRUE);

使工具条具有”pager” (customization) button just call:

m_wndToolBar.EnableCustomizeButton (TRUE, id_of_customize_command,
_T(“Customize…”));

使工具条的按钮下具有文字:

m_wndToolBar.EnableTextLabels (BOOL bEnable = TRUE);

使用户能自定义工具:

  • Add a new menu item: ID_TOOLS_ENTRY. This item will be automatically replaced by the actual tools list
  • Add the following items to the STRING resource:
     
    1. ID_TOOL1    “Activates user-defined tool\nUser Tool”
    2. ID_TOOL2    “Activates user-defined tool\nUser Tool”
      ….
    3. ID_TOOLx    “Activates user-defined tool\nUser Tool”
       
  • In application’s InitInstance() call:
     

    EnableUserTools (ID_TOOLS_ENTRY, ID_TOOL1,    ID_TOOLx);
  • A new “Tools” page will be added to the customization dialog

To enable dynamic “tear-off” (“detachable”) menus:

  • Reserve some items in the STRING resource table. These IDs will be used as control bars IDs
    1. ID_TEAR_OFF1    “<dummy>”
    2. ID_TEAR_OFF2    “<dummy>”
    3. …….
    4. ID_TEAR_OFFx    “<dummy>”
  • For each “tear-off” popup menu, change the “Break” property to “Bar” (MF_MENUBARBREAK)
  • In application’s InitInstance() call: 
    EnableTearOffMenus (_T(“RegBase”, ID_TEAR_OFF1, ID_TEAR_OFFx);

To enable static “tear-off” (“detachable”) menus:

  • Reserve an item in the STRING resource table. This ID should be differ from dynamic tear-off ID (see above)
    ID_TEAR_OFF_BAR    “<dummy>”
     
  • In the main frame OnShowPopupMenu, enable “tear-off” for the specific menu button:
     

    pMenuButton->SetTearOff (ID_TEAR_OFF_BAR);

To ensure, that all BCGPControlBar allocations are freed properly:

  • Add the following call into your application’s ExitInstance() :
    ::BCGCBProCleanUp ();
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/184520.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • P2P技术介绍

    P2P技术介绍BT技术其实是P2P技术的一种应用,所以先让我们来看一下什么是P2P技术:   P2P即PeertoPeer,称为对等连接或对等网络,P2P技术主要指由硬件形成连接后的信息控制技术,其代表形式是软件。  技术背景    P2P起源于最初的联网通信方式,如在建筑物内PC通过局域网互联,不同建筑物间通过Modem远程拨号互联。其中建立在TCP/IP协议之上的通信模式构成了今日互联网的

    2022年6月19日
    36
  • Hadoop切分纯文本时对某一行跨两个分片这种情况的处理

    Hadoop切分纯文本时对某一行跨两个分片这种情况的处理Hadoop切分纯文本时对某一行跨两个分片这种情况的处理

    2022年4月23日
    41
  • Ubuntu clion激活码2021.7【中文破解版】

    (Ubuntu clion激活码2021.7)最近有小伙伴私信我,问我这边有没有免费的intellijIdea的激活码,然后我将全栈君台教程分享给他了。激活成功之后他一直表示感谢,哈哈~IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月20日
    349
  • 读书笔记摘抄读后感大全_谈美读书笔记摘抄感悟

    读书笔记摘抄读后感大全_谈美读书笔记摘抄感悟推荐序1 什么是小米跟苹果正面撕的底气?认知盈余是所有互联网商业模式的一大基础理论,我用一句话总结为:下班时间产生的革命性力量。小米模式的本质,用雷军的话说,就是:硬件+互联网+新零售。品牌的竞争VS流量的竞争乔布斯认为,品牌仅次于技术。他有一个品牌秘方:革命性技术与营销的结合才是苹果成功的关键。苹果能卖出这么高的溢价,最重要一招就是品牌效应,而且是爆品级的品牌效应。我称之为:爆品+品牌…

    2022年9月3日
    2
  • SpringBoot调用第三方接口[通俗易懂]

    SpringBoot调用第三方接口[通俗易懂]Spring框架提供的RestTemplate类可用于在应用中调用rest服务,它简化了与http服务的通信方式,统一了RESTful的标准,封装了http链接,我们只需要传入url及返回值类型即可。相较于之前常用的HttpClient,RestTemplate是一种更优雅的调用RESTful服务的方式。RestTemplate默认依赖JDK提供http连接的能力(HttpURLConnect…

    2022年6月10日
    138
  • LG手机锁屏删除韩国时间_动态时钟锁屏

    LG手机锁屏删除韩国时间_动态时钟锁屏打开开发者模式,usb调试。连接电脑,命令行输入adbshellsettingsputsecureroaming_dualclock1adbshellsettingsputsecureskt_roaming_dualclock1如果显示等待手机连接,把手机连接电脑方式改为充电或图片,传输文件模式下usb调试连接不上国外完整版命令地址,可以删除预装软件…

    2022年9月29日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号