|
Support
ActiveX / COM
Visual C++ / MFC
Customer Spotlight
Corporate Partners
Contact Sales
Call center available M-F 9:00 - 6:00 US Eastern Time. U.S. and Canada International Email |
Create a custom theme for your application
Author: Kirk Stowell
Posted: November 16, 2004
Environment: Visual C++ MFC
You can create a custom theme for your application by deriving a class from any of the theme classes available in the toolkit. Create a double gripper theme similar to Visual Studio 6.0.
- CXTPDefaultTheme to inherit Office 2000 theme class CDoubleGripperTheme : public CXTPDefaultTheme {
}; 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); } else return CXTPDefaultTheme::DrawCommandBarGripper(pDC, pBar, bDraw); } int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ...
// Use our own theme for drawing command bar grippers. CXTPPaintManager::SetCustomTheme(new CDoubleGripperTheme());
return 0; }
|

