Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Toolkit User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

15.3 Gradient Caption Extension

The gradient caption extension provides a simple emulation of the smooth gradient caption effects introduced in Microsoft Office for Windows 95. The extension also allows you to control the alignment of caption text.


In order to match the Windows XP look and feel in a themed application, gradient caption extension will be automatically disabled if running under Windows XP and hosting application is themed.

Figure 116: Example Application with the Gradient Caption

15.3.1 The Gradient Caption Classes

The gradient caption feature is incorporated into the existing SECFrameWnd and SECMDIFrameWnd.

Figure 117: Objective Toolkit Gradient Frame Class Hierarchy

15.3.2 SECFrameWnd

The SECFrameWnd class derives from CFrameWnd and adds support for the gradient caption. The class also adds support for extended docking windows.

15.3.3 SECMDIFrameWnd

The SECMDIFrameWnd class derives from CMDIFrameWnd and adds support for the gradient caption and extended docking window features.

15.3.4 Using the Gradient Caption Feature

To incorporate the gradient caption into your application:

  1. Change the base class of your main frame window class, which is usually CMainFrame. If you're working with an MDI application, replace the base class (CMDIFrameWnd) with SECMDIFrameWnd. If you're working with an SDI application, replace the base class (CFrameWnd) with SECFrameWnd.

  2. Enable the gradient caption by calling EnableCustomCaption() from your frame window's OnCreate() member.

      int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
      {
          ...
      
          // Enable the gradient caption feature.
          EnableCustomCaption(TRUE);
      
          return 0;
      }
      

To change the font of the caption text:

  1. Derive a class from either SECMDIFrameWnd or SECFrameWnd. See the preceding procedure for more information.

  2. Override the CreateCaptionAppFont() method or the CreateCaptionDocFont() method or both. For example, the code below shows how to italicize the document font.

      void CMyFrameWnd::CreateCaptionDocFont(CFont& font)
      {
          NONCLIENTMETRICS ncm;
          ncm.cbSize = sizeof(ncm);
          VERIFY(SystemParametersInfo(
                    SPI_GETNONCLIENTMETRICS,
                    0, &ncm, 0));
          ncm.lfCaptionFont.lfItalic = TRUE;
          font.CreateFontIndirect(&ncm.lfCaptionFont);
      }
      


Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.