Office 2007 theme + animation + draw problem |
Post Reply |
Author | |
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
Posted: 09 July 2007 at 11:11pm |
I have two buttons, a play and stop button, where only one is enabled at a time. If I use Office 2007 theme + enable animation and click the play button, the effects blink rapidly as they fade away because the play button disables itself on click and the stop button is then enabled. |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
I've found the problem here, it was in my custom slider control for the command bars causing extra invalidates. void CXTPSliderCtrlToolbar::OnPaint(void) { const MSG *msg = GetCurrentMessage(); if( msg->wParam ) { CDC *pDC = CDC::FromHandle((HDC)msg->wParam); CRect rect; GetClientRect(&rect); CTransMemDC memDC(pDC, rect, SLIDER_COLORKEY); DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0); if( GetFocus() == this ) { CXTPPaintManager *pPaintMgr = static_cast<CXTPMDIFrameWnd *>(AfxGetMainWnd())->GetCommandBars()->GetPaintManager(); memDC.Draw3dRect(&rect, pPaintMgr->GetXtremeColor(COLOR_BTNSHADOW), pPaintMgr->GetXtremeColor(COLOR_BTNHIGHLIGHT)); } else if( (GetStyle() & WS_DISABLED) && m_bkColorKey != 0 ) { for( int y = rect.top; y < rect.bottom; y++ ) { for( int x = rect.left; x < rect.right; x++ ) { if( (x & 1) == (y & 1) ) { memDC.SetPixel(x, y, m_bkColorKey); } } } } } else { CPaintDC dc(this); // GetParent()->RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); if( pControl ) pControl->RedrawParent(FALSE); } } Instead of calling RedrawWindow, I had to capture the CXTPControlCustom pointer and call it's RedrawParent(). Now there is still another problem -- Office 2007 theme does NOT call WM_CTLCOLORSTATIC when drawing the slider bars, so the background is a solid blue color and not what SLIDER_COLORKEY needs for my transparent DC to work. How can I make my custom slider control use transparent background with Office 2007 theme? It worked great with Office 2003 theme before. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, Check Samples\CommandBars\CommandBarControls sample - it has slider + Ribbon theme.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Unfortunately, no, your CXTPControlSlider() will not work - I need
access to SetTickFreq() as well as removing TBS_BOTH and increasing the
height to 30px. Also, CXTPControlSlider() looks to be drawn in XP style even using Office 2007 Ribbon skin:
The class I've been using since 9.81 and before works fine still, and is even drawn in the correct Office 2007 style: If I manually set my key color to RGB(191, 219, 255) to match that background color, it is drawn correctly too: However, that would NOT draw correctly on other systems or themes with the hard-coded key color. I really need it to somehow obey WM_CTLCOLORSTATIC like it still does if I use Office 2003 theme. |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Ok, I've found a solution so I can keep using my custom control. Instead of hooking WM_CTLCOLORSTATIC from CXTPControlCustom-derived class with XTPHookManager, I moved the same code to ON_WM_CTLCOLOR_REFLECT in the CSliderCtrl-derived class and it works for Office 2007 while still working the same for Office 2003 theme.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |