SliderCtrl:missing selection highlight |
Post Reply |
Author | |
collabear
Newbie Joined: 13 September 2007 Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 13 September 2007 at 6:51am |
Slider ctrl missing selection highlight when apply a skin, how to add it? |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
You must code it yourself when using Windows XP themes or Office 2007 skin with Codejock - it's not a Codejock issue really, but a design choice of Windows XP. Without Codejock, you can just derive from CSliderCtrl to fix this: void CMySliderCtrl::OnCustomDraw(NMHDR *pNotifyStruct, LRESULT *result) { NMCUSTOMDRAW *pNmcd = (NMCUSTOMDRAW *)pNotifyStruct; switch( pNmcd->dwDrawStage ) { case CDDS_PREPAINT: if( GetStyle() & TBS_ENABLESELRANGE ) { *result = CDRF_NOTIFYITEMDRAW; } break; case CDDS_ITEMPREPAINT: switch( pNmcd->dwItemSpec ) { case TBCD_CHANNEL: { CDC *pDC = CDC::FromHandle(pNmcd->hdc); CRect rcChannel; GetChannelRect(&rcChannel); rcChannel.DeflateRect(6, 3); int min, max, selmin, selmax; GetRange(min, max); GetSelection(selmin, selmax); max -= min; selmin = (int)(((double)(selmin - min) / max * rcChannel.Width()) + 0.5) + rcChannel.left; selmax = (int)(((double)(selmax - min) / max * rcChannel.Width()) + 0.5) + rcChannel.left; rcChannel.left = selmin; rcChannel.right = selmax; pDC->FillSolidRect(rcChannel, static_cast<CXTPMDIFrameWnd *>(AfxGetMainWnd())->GetCommandBars()->GetPaintManager()->GetXtremeColor(COLOR_HIGHLIGHT)); pDC->ExcludeClipRect(rcChannel); *result = CDRF_DODEFAULT | CDRF_NOTIFYPOSTPAINT; break; } } break; case CDDS_ITEMPOSTPAINT: switch( pNmcd->dwItemSpec ) { case TBCD_CHANNEL: { CDC *pDC = CDC::FromHandle(pNmcd->hdc); pDC->SelectClipRgn(NULL); break; } } break; } } But with Office 2007 skin and such, Codejock does not support CDRF_NOTIFYITEMDRAW in 11.2. A patch for 11.2.1 adds support though. |
|
collabear
Newbie Joined: 13 September 2007 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Thank you very much!
|
|
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 |