|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Lorin Jameson
|
Oct 12, 2004 - 12:37 PM
|
I have an application that uses numerous spin controls. I notice that in the ProfUIS_Controls project, a spinner is used which seems to have appropriates colored arrow buttons for the spinner in Office 2003 mode, yet I cannot seem to see how that is being accomplished. Any guidance here?
|
|
Technical Support
|
Oct 13, 2004 - 10:44 AM
|
Dear Lorin,
The ProfUIS_Controls sample does not have any spinner control (a.k.a, "up-down control"). We assume you mean the slider or some other control in toolbars. Any such a control is not a window (iow, not a HWND-based). It is derived from the CExtBarButton that implements a button on the toolbar. You cannot use it in dialogs "as is".
Here is the source code for the CStyledSliderWnd class which implements a slider control with a background based on Prof-UIS theme:class CStyledSliderWnd : public CSliderCtrl
{
protected:
virtual LRESULT WindowProc(
UINT message,
WPARAM wParam,
LPARAM lParam
)
{
ASSERT_VALID( this );
if( message == WM_MOUSEACTIVATE )
return MA_NOACTIVATE;
if( message == WM_SETFOCUS )
{
::SetFocus( ::GetParent(m_hWnd) );
return 0L;
}
if( message == WM_ERASEBKGND )
return TRUE;
if( message == WM_NCCALCSIZE )
return 0L;
if( message == WM_PAINT )
{
CPaintDC dcPaint( this );
CExtPaintManager::stat_ExcludeChildAreas(
dcPaint.GetSafeHdc(),
GetSafeHwnd()
);
CRect rcClient;
GetClientRect( &rcClient );
CExtMemoryDC dc(
&dcPaint,
&rcClient
);
if( g_PaintManager->GetCb2DbTransparentMode(this) )
g_PaintManager->PaintDockerBkgnd( dc, this );
else
dc.FillSolidRect(
&rcClient,
g_PaintManager->GetColor(
CExtPaintManager::CLR_3DFACE_OUT
)
);
DWORD dwWndStyle = GetStyle();
bool bHorz =
( (dwWndStyle&TBS_VERT) != 0 ) ? false : true;
COLORREF clrFace =
g_PaintManager->GetColor( COLOR_3DFACE );
COLORREF clrHilight =
g_PaintManager->GetColor( COLOR_3DHILIGHT );
COLORREF clrShadow =
g_PaintManager->GetColor( COLOR_3DSHADOW );
CRect rcChannel;
//CSliderCtrl::GetChannelRect( &rcChannel );
rcChannel = rcClient;
CRect rcThumb;
CSliderCtrl::GetThumbRect( &rcThumb );
if( bHorz )
{
rcChannel.top = rcThumb.top;
rcChannel.bottom = rcThumb.bottom;
rcChannel.DeflateRect(
rcThumb.Width(),
( rcChannel.Height() - rcThumb.Width() ) / 2
);
} // if( bHorz )
else
{
rcChannel.left = rcThumb.left;
rcChannel.right = rcThumb.right;
rcChannel.DeflateRect(
( rcChannel.Width() - rcThumb.Height() ) / 2,
rcThumb.Height()
);
} // else from if( bHorz )
dc.FillSolidRect( &rcChannel, clrFace );
dc.Draw3dRect( &rcChannel, clrShadow, clrHilight );
dc.FillSolidRect( &rcThumb, clrFace );
dc.Draw3dRect( &rcThumb, clrHilight, clrShadow );
return TRUE;
} // if( message == WM_PAINT )
LRESULT lResult =
CSliderCtrl::WindowProc( message, wParam, lParam );
return lResult;
}
}; // class CInplaceSliderWnd
|
|
Lorin Jameson
|
Oct 13, 2004 - 12:35 PM
|
Actually, on status bar page there is a attached spinner to the position edit box. It has blue buttons.
|
|
Technical Support
|
Oct 14, 2004 - 2:39 AM
|
Prof-UIS does not have any spin controls. The spin control used in the ProfUIS-Controls sample is a standard Windows control. Its arrows are colored only when a Windows XP theme is enabled.
|
|