Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS General Discussion » Slider control Collapse All
Subject Author Date
Nikita Davydov Apr 7, 2005 - 6:09 AM

How can place in my dialog with Office 2003 style (in blue palette) a slider control? I cannot find any class for it in Prof-UIS. If I use standart CSliderCtrl, it looks grey. I want it to be in the same Office 2003 style as all other controls.


Nikitos I

Technical Support Apr 8, 2005 - 4:08 AM

The following class was specially coded for the AdoRecordsetView sample application:

class CInplaceSliderWnd : public CSliderCtrl
{
protected:
virtual LRESULT WindowProc(
    UINT message,
    WPARAM wParam,
    LPARAM lParam
       )
   {
    ASSERT_VALID( this );
    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(
                true,
                dc,
                this
                   );
        else
            dc.FillSolidRect(
                   &rcClient,
                g_PaintManager->GetColor(
                    CExtPaintManager::
                        CLR_3DFACE_OUT,
                    this
                       )
                   );
        DWORD dwWndStyle =
            GetStyle();
        bool bHorz =
               ( (dwWndStyle&TBS_VERT) != 0 )
                   ? false : true;
        COLORREF clrFace =
            g_PaintManager->GetColor(
                COLOR_3DFACE,
                this
                   );
        COLORREF clrHilight =
            g_PaintManager->GetColor(
                COLOR_3DHILIGHT,
                this
                   );
        COLORREF clrShadow =
            g_PaintManager->GetColor(
                COLOR_3DSHADOW,
                this
                   );
        CRect 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
Is this what you need?