Xtreme Suite Pro使用教程:如何创建应用程序自定义主题

Codejock 软件的Xtreme Command Bars 提供非常漂亮的Office风格的命令条和One Note样式的Tab. 这种构架完全支持菜单和工具栏的个性化设置, 它将在应用程序工作台上给你更大的控制权, Xtreme Command Bars提供嵌入式主题支持,允许你选择预先定义的主题如Officexp、Office 2003、 Visual Studio .NET,或者自定义主题。它是Xtreme Suite的一部分。

Xtreme Command Bars最新试用版

为您的应用程序创建自定义主题

您可以通过从工具包中可用的任何主题类派生一个类来为您的应用程序创建自定义主题。

创建类似于Visual Studio 6.0的双重抓取器主题。

  1. 创建一个新类,可以工具包中找通过预定义主题实现。我们将使用CXTPDefaultTheme,但是您可以使用以下任何主题类:

    CXTPDefaultTheme to inherit Office 2000 theme
    CXTPOfficeTheme to inherit Office XP theme
    CXTPOffice2003Theme to inherit Office 2003 theme
    CXTPNativeXPTheme to inherit Native XP theme

    class CDoubleGripperTheme : public CXTPDefaultTh
  2. 重写CXTPDefaultTheme基类的DrawCommandBarGripper(请参阅XTPPaintManager.h)。这样我们就能够添加自己的自定义外观以绘制命令栏抓手
  3.  class CDoubleGripperTheme : public CXTPDefaultTheme {     virtual CSize DrawCommandBarGripper(         CDC* pDC, CXTPCommandBar* pBar, BOOL bDraw); }; [...] // DrawCommandBarGripper function. // if bDraw if FALSE must return gripper size. // if bDraw is TRUE must draw gripper.  CSize CDoubleGripperTheme::DrawCommandBarGripper(CDC* pDC,      CXTPCommandBar* pBar, BOOL bDraw) {     // If Toolbar is vertical docked     if (pBar->GetPosition() == xtpBarRight ||         pBar->GetPosition() == xtpBarLeft)     {         if (bDraw)         {             CXTPClientRect rc(pBar);             Draw3dRect(pDC, CRect(3, 3, rc.right - 3, 6),                 COLOR_BTNHILIGHT, COLOR_3DSHADOW);             Draw3dRect(pDC, CRect(3, 7, rc.right - 3, 10),                 COLOR_BTNHILIGHT, COLOR_3DSHADOW);         }         return CSize(0, 10);     }     // if Toolbar is horizontal  docked     else if (pBar->GetPosition() == xtpBarTop ||             pBar->GetPosition() == xtpBarBottom)         {            CXTPClientRect rc(pBar);            if (bDraw)            {                Draw3dRect(pDC, CRect(3, 3, 6, rc.bottom - 3),                    COLOR_BTNHILIGHT, COLOR_3DSHADOW);                Draw3dRect(pDC, CRect(7, 3, 10, rc.bottom - 3),                    COLOR_BTNHILIGHT, COLOR_3DSHADOW);            }             return CSize(10, 0);         }    }    return CXTPDefaultTheme::DrawCommandBarGripper(pDC, pBar, bDraw); }
  4. 从CMainFrame的OnCreate方法调用CXTPPaintManager :: SetCustomTheme以使用我们刚刚创建的主题
  5.  int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {     ...         // Use our own theme for drawing command bar grippers.         CXTPPaintManager::SetCustomTheme(new         CDoubleGripperTheme());     return 0; }

如果你对我们的产品感兴趣或者有任何疑问,欢迎咨询在线客服>>

高端UI界面开发
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年7月3日
下一篇 2020年7月3日

相关推荐

发表回复

登录后才能评论