Click here to Skip to main content
Click here to Skip to main content

XScrollBar - Scroll bar like Windows Media Player's

By , 2 Sep 2008
 

Introduction

Recently I needed a scroll bar that looked and acted like the one in Windows Media Player:

screenshot

The closest one I could find was the CSkinHorizontalScrollbar class in Greg Ellis's article, but it did not support colors. So I created XScrollBar, which has following features:

  • Support for both horizontal and vertical scroll bars
  • Optional color displayed on thumb and in channel
  • Optional gripper displayed on thumb
  • Hand cursor is displayed when mouse hovers over thumb
  • Thumb color (if enabled) is changed to "hot color" when mouse hovers over thumb
  • Hot/pressed states displayed for arrow buttons
  • Thumb changes to hot state when control has focus
  • Responds to both mouse and keyboard input
  • Clicking in channel moves thumb to that spot (which is more intuitive than behavior of standard CScrollBar)
  • Left and right arrow buttons move thumb by one unit
  • Scroll messages (WM_HSCROLL) are sent to owner window
  • The scroll bar and its components should be sized according to the size of a specified rect

CXScrollBar In Action

To demonstrate new scroll bar, I decided to create an RGB color tool, which would benefit from having colors displayed on scroll bars:

screenshot

Turning off thumb color also turns off channel color:

screenshot

You can also turn off channel color by itself:

screenshot

The thumb gripper can also be disabled:

screenshot

Using CXScrollBar

Use of XScrollBar will usually be in dialogs, but you can create XScrollBar anywhere by using one of the two Create functions.

CreateFromWindow()

//=============================================================================
//
// CreateFromWindow
//
// Purpose:     Create the CXScrollBar control from placeholder window
//
// Parameters:  dwStyle    - the scroll bar’s style. Typically this will be
//                           SBS_HORZ|WS_CHILD|SS_LEFT|SS_NOTIFY|WS_VISIBLE.
//              pParentWnd - the scroll bar’s parent window, usually a CDialog
//                           object. It must not be NULL.
//              hWnd       - HWND of placeholder window (must already exist)
//              nId        - the resource id of the CXScrollBar control
//
// Returns:     BOOL       - TRUE = success
//

Here is how the CreateFromWindow() function is used in the demo app:

    // red
    VERIFY(m_HorizontalScrollBar1.CreateFromWindow(
        SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP,
        this, GetDlgItem(IDC_SCROLL1_RECT_HORZ)->m_hWnd, IDC_SCROLL1_HORZ));

After creating the XScrollBar control, the demo app then sets its range, color, and gripper options:

    m_HorizontalScrollBar1.SetScrollRange(0, 255)
                          .SetThumbColor(RGB(255,0,0))
                          .EnableThumbGripper(m_bThumbGripper);

Setting thumb color also has effect of enabling display of thumb color. The channel color is enabled by default, and will be displayed if thumb color is enabled.

CreateFromRect()

In case it is not convenient to create a placeholder window, you can also create XScrollBar control by specifying rect:

//=============================================================================
//
// CreateFromRect
//
// Purpose:     Create the CXScrollBar control from rect
//
// Parameters:  dwStyle    - the scroll bar’s style. Typically this will be
//                           SBS_HORZ|WS_CHILD|SS_LEFT|SS_NOTIFY|WS_VISIBLE.
//              pParentWnd - the scroll bar’s parent window, usually a CDialog
//                           object. It must not be NULL.
//              rect       - the size and position of the window, in client 
//                           coordinates of pParentWnd
//              nId        - the resource id of the CXScrollBar control
//
// Returns:     BOOL       - TRUE = success
//

Implementation Notes

XScrollBar Component Structure

The diagram below shows the components of an XScollBar, and the nomenclature that will be used in this article:

screenshot

As you probably guessed, the XScrollBar is drawn in five steps (six, if you count the border). The drawing takes place in DrawHorizontal() function.

Drawing the XScrollBar: Step 1 - Left Arrow Button

The left arrow button bitmap looks like this (the orange border is not part of the bitmap):

screenshot

One thing to note is that arrow bitmaps and thumb bitmap are assumed to be all the same size, which simplifies some calculations. The size of the thumb bitmap (m_nBitmapWidth, m_nBitmapHeight) is set in the CreateFromStatic() function.

Knowing that width of the left arrow bitmap = width of the thumb bitmap, we can write

    CRect rectLeftArrow(m_rectClient.left, m_rectClient.top,
        m_rectClient.left + m_nBitmapWidth, m_rectClient.bottom);

StretchBlt() is then called to copy the left arrow bitmap into the memory DC, and a border is drawn around the left arrow. Note that the bitmaps do not include a border, because StretchBlt() may decide to duplicate the row that contains the border, and you will end up with a thick line on the bottom.

Drawing the XScrollBar: Steps 2 & 3 - Channel

Next we draw channel. In case a color is being displayed in the channel, it must be drawn in two parts. Because we modify the bitmap to add color, we draw the right channel (the part without color) first.

The channel bitmap is one pixel wide and looks like this (the orange border is not part of the bitmap):

screenshot

Earlier, we set the channel position and width from the thumb width:

    int nChannelStart = m_rectClient.left + m_nBitmapWidth;
    int nChannelWidth = m_rectClient.Width() - 2*m_nBitmapWidth;

Now we use these values to define the rect for the right channel:

    CRect rectChannelRight(m_rectThumb.left + m_nBitmapWidth/2, m_rectClient.top,
    nChannelStart + nChannelWidth, m_rectClient.bottom);

StretchBlt() is then called to copy the right channel bitmap into the memory DC.

If a thumb color and channel color (both are required) are desired, then we must modify the channel bitmap to add color. But what color to use? Here is where Christian Rodemeyer's CColor class comes in. We use CColor to convert the RGB thumb color to HLS, and then lighten the color by adjusting the HLS values. Finally, we convert back to RGB, and this is new channel color.

    if (m_bChannelColor && m_bThumbColor)
    {
        COLORREF rgb1, rgb2, rgb3;
        GetChannelColors(rgb1, rgb2, rgb3);

        BITMAP bm;
        bmpChannel.GetBitmap(&bm);

        // set highlight colors
        bitmapDC.SetPixel(0, 0, rgb1);
        bitmapDC.SetPixel(0, 1, rgb2);

        // set main color
        for (int y = 2; y < (bm.bmHeight); y++)
            bitmapDC.SetPixel(0, y, rgb3);
    }

and here is GetChannelColors():

//=============================================================================
void CXScrollBar::GetChannelColors(COLORREF& rgb1, 
                                   COLORREF& rgb2, 
                                   COLORREF& rgb3)
//=============================================================================
{
    CColor color;
    color.SetRGB(GetRValue(m_ThumbColor),
                 GetGValue(m_ThumbColor), 
                 GetBValue(m_ThumbColor));
    color.ToHLS();
    float fLuminance = color.GetLuminance();

    // use 80% L, 50% S for main color
    fLuminance = 0.8f;
    float fSaturation = color.GetSaturation();
    fSaturation = 0.5f * fSaturation;
    float fHue = color.GetHue();
    color.SetHLS(fHue, fLuminance, fSaturation);
    color.ToRGB();
    rgb3 = RGB(color.GetRed(), color.GetGreen(), color.GetBlue());

    // use .87 L for second highlight color
    fLuminance = .87f;
    color.SetHLS(fHue, fLuminance, fSaturation);
    color.ToRGB();
    rgb2 = RGB(color.GetRed(), color.GetGreen(), color.GetBlue());

    // use .92 L for first highlight color
    fLuminance = .92f;
    color.SetHLS(fHue, fLuminance, fSaturation);
    color.ToRGB();
    rgb1 = RGB(color.GetRed(), color.GetGreen(), color.GetBlue());
}

We can now define the rect for the left channel:

    CRect rectChannelLeft(nChannelStart, m_rectClient.top,
        m_rectThumb.left + m_nBitmapWidth/2, m_rectClient.bottom);

StretchBlt() is then called to copy the left channel bitmap into the memory DC

Drawing the XScrollBar: Step 4 - Right Arrow Button

The right arrow button bitmap looks like this (the orange border is not part of the bitmap):

screenshot

The right arrow button is drawn much like the left arrow button.

Drawing the XScrollBar: Step 5 - Thumb

The thumb bitmap (for a thumb with no color) looks like this:

screenshot

For a thumb with color it looks like:

screenshot

The thumb bitmaps are modified before being drawn to the memory DC. For a thumb with no color, the only modification that may be necessary is to replace the thumb gripper pixels with pixels taken from the surrounding area on the thumb, thus making the gripper disappear (how this is done will be explained below).

For a thumb with color, in addition to the gripper pixels, it is also necessary to make the corner pixels transparent (i.e., same color as channel). and to add the selected thumb color (or hover color). All these changes are accomplished by using four "special" RGB color values:

RGB Value Use
RGB(0, 0, 1) Thumb color (or hover color)
RGB(0, 0, 2) Gripper
RGB(0, 0, 3) Transparent left color
RGB(0, 0, 4) Transparent right color

These colors are used in the thumb bitmaps as shown here:

screenshot

Note that the thumb with no color only has the RGB(0, 0, 2) color.

Here is the code that performs these pixel replacements:

    CClientDC dc(this);

    CDC bitmapDC;
    bitmapDC.CreateCompatibleDC(&dc);

    CBitmap *pOldBitmap = bitmapDC.SelectObject(&m_bmpThumbHot);

    // add desired hot color to thumb
    ColorThumb(&bitmapDC, m_ThumbHoverColor);

    bitmapDC.SelectObject(&m_bmpThumb);

    // add desired cold color to thumb
    ColorThumb(&bitmapDC, m_ThumbColor);

and here is ColorThumb():

//=============================================================================
void CXScrollBar::ColorThumb(CDC *pDC, COLORREF rgbThumb)
//=============================================================================
{
    COLORREF rgbPrev = 0;

    // add desired hot color to thumb
    for (int x = 0; x < m_nBitmapWidth; x++)
    {
        for (int y = 0; y < m_nBitmapHeight; y++)
        {
            COLORREF rgb = pDC->GetPixel(x, y);

            if (m_bThumbColor && (rgb == THUMB_MASK_COLOR))
            {
                pDC->SetPixel(x, y, rgbThumb);
            }
            else if (rgb == THUMB_GRIPPER_MASK_COLOR)
            {
                if (m_bThumbGripper)
                    pDC->SetPixel(x, y, THUMB_GRIPPER_COLOR);
                else
                    pDC->SetPixel(x, y, rgbPrev);
            }

            rgbPrev = rgb;
        }
    }
}

This technique for coloring the thumb and channel works for True Color (24-bit). Lower resolutions may require you to use other RGB values for the four "special" RGB thumb colors, and it may also require that you limit the color used in the channel.

Mouse Hover

A final thing to take care of is when the mouse hovers over the thumb. In this case, the thumb color will be changed to the hover color (as seen in the above code), and the cursor will be changed to a hand:

screenshot

This is handled in the OnSetCursor() function.

How To Use

To integrate XScrollBar into your app, you first need to add following files to your project:

  • XScrollBar.cpp
  • XScrollBar.h
  • Color.cpp
  • Color.h
  • memdc.h

Next copy the bitmap files to the project's res directory, and add the bitmaps to the .rc file. I find it easiest just to edit the .rc file manually:

/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_HORIZONTAL_SCROLLBAR_LEFTARROW BITMAP  DISCARDABLE      "res\\HorizontalScrollBarLeftArrow.bmp"
IDB_HORIZONTAL_SCROLLBAR_RIGHTARROW BITMAP  DISCARDABLE     "res\\HorizontalScrollBarRightArrow.bmp"
IDB_HORIZONTAL_SCROLLBAR_CHANNEL BITMAP  DISCARDABLE        "res\\HorizontalScrollBarChannel.bmp"
IDB_HORIZONTAL_SCROLLBAR_THUMB BITMAP  DISCARDABLE          "res\\HorizontalScrollBarThumb.bmp"
IDB_HORIZONTAL_SCROLLBAR_THUMB_NO_COLOR BITMAP  DISCARDABLE "res\\HorizontalScrollBarThumbNoColor.bmp"
IDB_VERTICAL_SCROLLBAR_UPARROW BITMAP  DISCARDABLE          "res\\VerticalScrollBarUpArrow.bmp"
IDB_VERTICAL_SCROLLBAR_DOWNARROW BITMAP  DISCARDABLE        "res\\VerticalScrollBarDownArrow.bmp"
IDB_VERTICAL_SCROLLBAR_CHANNEL BITMAP  DISCARDABLE          "res\\VerticalScrollBarChannel.bmp"
IDB_VERTICAL_SCROLLBAR_THUMB BITMAP  DISCARDABLE            "res\\VerticalScrollBarThumb.bmp"
IDB_VERTICAL_SCROLLBAR_THUMB_NO_COLOR BITMAP  DISCARDABLE   "res\\VerticalScrollBarThumbNoColor.bmp"
And add the bitmap IDs to resource.h:
#define IDB_HORIZONTAL_SCROLLBAR_LEFTARROW        201
#define IDB_HORIZONTAL_SCROLLBAR_RIGHTARROW       202
#define IDB_HORIZONTAL_SCROLLBAR_CHANNEL          203
#define IDB_HORIZONTAL_SCROLLBAR_THUMB            204
#define IDB_HORIZONTAL_SCROLLBAR_THUMB_NO_COLOR   205
#define IDB_VERTICAL_SCROLLBAR_UPARROW            206
#define IDB_VERTICAL_SCROLLBAR_DOWNARROW          207
#define IDB_VERTICAL_SCROLLBAR_CHANNEL            208
#define IDB_VERTICAL_SCROLLBAR_THUMB              209
#define IDB_VERTICAL_SCROLLBAR_THUMB_NO_COLOR     210

Of course, you should verify the numerical IDs are unique.

Future Enhancements

  • Add "scroll tip".
  • Add option to flip vertical orientation.

Acknowledgments

  • Thanks to Greg Ellis for his CSkinHorizontalScrollbar class, which I used as the starting point for CXScrollBar.
  • Thanks to Steve Mayfield for supplying the code for vertical scroll bars.
  • Thanks to Christian Rodemeyer for his CColor class.
  • I used HPS PixelColor to capture screen colors and inspect the scroll bar on the screen.
  • I used Impict, which ships with Help & Manual, to annotate the images.

Revision History

Version 1.2 - 2008 August 29

  • Optimized bitmap loading
  • Changed to CWnd
  • Added hot state to arrows and thumb (no color)
  • Added pressed state to arrows
  • Focus shown by hot state of thumb
  • Added CreateFromWindow() and CreateFromRect() functions
  • Removed CreateFromStatic()
  • Added GetScrollRange()
  • Added keyboard input

Version 1.1 - 2004 September 21

  • Update with Steve Mayfield's vertical scroll bar implementation.

Version 1.0 - 2004 September 9

  • Initial public release.

Usage

This software is released into the public domain. You are free to use it in any way you like, except that you may not sell this source code. If you modify it or extend it, please to consider posting new code here for everyone to share. This software is provided "as is" with no expressed or implied warranty. I accept no liability for any damage or loss of business that this software may cause.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Hans Dietrich
Software Developer (Senior) Hans Dietrich Software
United States United States
I attended St. Michael's College of the University of Toronto, with the intention of becoming a priest. A friend in the University's Computer Science Department got me interested in programming, and I have been hooked ever since.
 
Recently, I have moved to Los Angeles where I am doing consulting and development work.
 
For consulting and custom software development, please see www.hdsoft.org.






Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 4memberTinhiuvanoinho23-Jul-11 6:15 
good
Newsnow free Dll-VersionmemberDuddits123-Feb-09 21:03 
For easy integration into your own projects I coded a DLL-Version (especially designed for use with VB6): http://www.arltsoft.de/XPScrollbar/XPScrollbar.html
 
Thomas
General[Message Removed]memberKatekortez25-Oct-08 9:29 
Spam message removed
QuestionCan I change the channel color?memberDieter683-Oct-08 6:39 
Hi,
 
is there a possibility to change the thumb and channel color at runtime?
I want to show critical values by changing the channel + thumb color to red.
I tried it with SetThumbColor.
Effect: The channel changes its color, but not the thumb. When I move the mouse over the ScrollBar, it changes the color back to the original color.
 
Any ideas?
 
Thanks
Dieter
 
...

AnswerRe: Can I change the channel color?mvpHans Dietrich3-Oct-08 9:56 
Hi Dieter,
 
First, please make sure you have v1.2.
 
There are two colors involved - the normal color and the hover color. If you call SetThumbColor(), this changes the normal color. Currently, SetThumbColor() works correctly and the non-hover (normal) thumb color will be changed.
 
However, the same is not true for SetThumbHoverColor(). It is missing a call to LoadThumbBitmap(). Here is the fixed function:
    CXScrollBar& SetThumbHoverColor(COLORREF rgb) 
    { m_ThumbHoverColor = rgb; LoadThumbBitmap(); return *this; }
With this fix, both functions will now update the thumb colors. Of course, you do not need to call both, if all you want to do is set the normal (non-hover) color.
 
Please let me know if this answers your question.
 

AnswerRe: Can I change the channel color?mvpHans Dietrich3-Oct-08 10:02 
I forgot to mention that with v1.2, the thumb color will change to the hover color when it has focus. This is consistent with the way the standard slider control works.
 

GeneralRe: Can I change the channel color?memberDieter686-Oct-08 7:14 
Hello Hans,
 
now it works.
I had just a stupid error in my own program.
 
Thank you very much for the tips
Dieter
 
...

QuestionNegative Values?memberDieter6815-Sep-08 9:38 
Hi,
 
is there a way to work with a range which starts with values unequal to 0? It doesn't matter if I select negative or positive values for the lower range, it starts always with 0.
 
Thanks
Dieter
 
...

AnswerRe: Negative Values?mvpHans Dietrich15-Sep-08 9:53 
Support for negative values is not currently built into XScrollBar, but you could easily normalize the negative value to a positive range, and then un-normalize in the WM_xSCROLL handler. I will try to add this in next update.
 

QuestionBig orange box?membersk8er_boy2872-Sep-08 22:11 
What's with the big orange box on the left of the demo dialogs? That orange color looks familiar. I wonder where I've seen it before...Confused | :confused:
AnswerRe: Big orange box?mvpHans Dietrich2-Sep-08 22:23 
I tried to make it white, but that damned orange color keeps popping up. Probably a compiler glitch. Smile | :)
 

QuestionHow to use the control for a dialog box.membermanish.indiainc1-Feb-07 1:43 
Hi All,
How we can use this control for scrolling dialog(i.e scrollbar for dialog box). In my case the some part of the static box disappears OnVscroll.
Do i need to create static box and scrollbar every time i scroll?????
If Anyone of u have any idea , plz reply or mail.
 
Thanks in Advance
 

 
Manish Kumar
GeneralUsing control with child dialog box.membermanish.indiainc30-Jan-07 20:30 
Hi
Superb design of the scrollbar. Smile | :)
 
But I have a small problem on using this control in my child dialog box
The control is not shown at all.Only i am able to see the hand cursor.
 
note: I am creating the modeles child dialog box dynamically and also resizing it after creation.And i am creating the scrollbar control in OnInItDialog() of the child dialog
Thanks in Advance
 
Manish Kumar
GeneralBind the XScrollBar with TreeView Controlmemberaka21097-Sep-06 18:29 
Hi
 
I am having a treeview control in .NET. i want to bind the scrolling event of the treeview control with the XScrollbar scrolling. How do i accomplish that. I tried searching on the net about the same but could not succeed.
 
Any help wud be appreciated.
Thanks in advance.
 
A.K
GeneralGood, yet...memberFernando A. Gómez F.12-Jul-06 13:10 
This article is quite good, you saved my butt.
 
Just one suggestion. It'll be nice that in the CreateFromStatic you do not assume that the parent window is a CDialog. I had to modify that. It is better to use the GetWindow command and get its ID rather than using GetDlgItem and force the parent to be a CDialog.
 
Another suggestion, you should write a Create method that calls Create, just in case that I don't want to create it from an existing CStatic.
 
Regards,
Fernando.
 
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Generalhimemberpingye@hanmail.net24-Aug-05 20:52 
I am at a loss how to do thumb size change.
what if to do?
 

 

 
hi
GeneralProblem resizing controlmemberObliterator8-Jul-05 4:38 
Absolutely superb control, I have just the place for it in my project. Thanks!
 
One small problem, the control does not detect if it is ever resized.
The following code easily resolves that:
 
void CXScrollBar::OnSize(UINT nType, int cx, int cy) 
{
	CStatic::OnSize(nType, cx, cy);
	
	if(m_hWnd)
	{
		GetClientRect(&m_rectClient);
		UpdateThumbPosition();
	}
}

 
--
 
The Obliterator
General256 colorsmemberKonrad Windszus21-Sep-04 0:16 
Is there a way to ensure that this scroll bar does also look fine on 256 color machines? Would you perhaps consider this in one of the next updates? Nonetheless your article and control is great.
 
Konrad
QuestionCStatic base class?memberPJ Arends17-Sep-04 8:42 
First let me say that this is an excellent class and article. But I do wonder why you used CStatic as the base class and not CScrollBar. The way it is now, it can not be used as a drop in replacement for any scrollbars that I currently use because your control will not respond to standard SBM_* scrollbar messages.
 
Read http://www.codeproject.com/miscctrl/customcontrols1.asp[^], especially the section on HWND, WPARAM and LPARAM.
 
You could make this excellent piece of work actually usable.
 


"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
 
"Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04
 
Within you lies the power for good - Use it!
AnswerRe: CStatic base class?memberPJ Arends17-Sep-04 11:04 
This control has another major short coming: It is usable with the mouse only. You have included absolutly no keyboard functionality. So far all it is is pretty drawing with very limited use.
 
I prefer controls that are rich in function over ones that look pretty.
 
I would rate this control, as it stands right now, a 2. But I will refrain from voting until you have had a chance to update it.
 


"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
 
"Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04
 
Within you lies the power for good - Use it!
GeneralRe: CStatic base class?memberHans Dietrich20-Sep-04 7:21 
PJ Arends wrote:
It is usable with the mouse only.
 
You are correct. When I was initially exploring the WMP scroll bar, I thought it ignored all keystrokes. I was mistaken; it does handle the 4 arrow keys (but not Page Up or Page Down), when the scroll bar has the input focus (as it does after you have clicked on it with the mouse). I will update XScrollBar with this functionality as soon as possible.
 
It is also interesting that the WMP scroll bar displays a focus rect when you tab to it, but not when you click on it; and that the focus rect disappears after about 5 seconds.

AnswerRe: CStatic base class?memberHans Dietrich20-Sep-04 7:05 
Yes, CScrollBar was also my first thought. However, I wanted to emulate the WMP behavior ("Clicking in channel moves thumb to that spot"), and I found that the positioning behavior of CScrollBar was not compatible with my goal, and the code was becoming very complex. Since it was obvious that I had to replace (not build on) the CScrollBar behavior, using CStatic as a base class just made things much simpler.
 
I will say more on this in my answer to your next post.
GeneralIt's just ..... so good!membervngo17-Sep-04 7:45 
There is quite few scrollbar classes in whole CodeProject site, and they are not realy useful at all compare to the one I am writing. Good work!!! thank you.
QuestionHow to disable control?memberCCTV15-Sep-04 10:18 
First of all, great job on this control and the thorough article.
 
I need to enable or disable the control based on a user selection. I tried this using m_HorizontalScollBar1.EnableWindow( FALSE ), but this doesn't seem to work. In fact, the control vanished until I moved the mouse over it.
 
Do you have any suggestions on how to enable/disable?
 
Thanks,
 


AnswerRe: How to disable control?memberSteve Mayfield15-Sep-04 20:45 
Try this:
 
void CXScrollBarTestDlg::OnEnableScrollBar1() 
{
  m_HorizontalScrollBar1.EnableWindow(TRUE); 	
  m_HorizontalScrollBar1.RedrawWindow();
}
 
void CXScrollBarTestDlg::OnDisableScrollBar1() 
{
  m_HorizontalScrollBar1.EnableWindow(FALSE); 	
  m_HorizontalScrollBar1.RedrawWindow();
}
 
Because this is an owner drawn control, the control will not "dim" like regular controls, but when disabled, it will stop taking input.
 
Steve
GeneralThumb gripper shows black.memberWREY11-Sep-04 10:14 
Even when the checkbox is checked, and other colors are chosen, and other checkboxes are checked.
 
Good work nonetheless!
 
Smile | :)
 
William
 
Fortes in fide et opere!
GeneralRe: Thumb gripper shows black.memberSteve Mayfield11-Sep-04 17:04 
Do you have your video display set for 24 bits? The app works perfectly on multiple machines for me (XP & W2K)
 
Steve
GeneralRe: Thumb gripper shows black.memberWREY11-Sep-04 20:12 
Thanks! I set it to 32 and that did the trick.
 
Smile | :)
 
William
 
Fortes in fide et opere!
GeneralAs soon as I saw it...memberSteve Mayfield9-Sep-04 19:24 
I have the perfect place for it in a project I have been working on for 2 years...another 5!
 
Steve
GeneralRe: As soon as I saw it...memberSteve Mayfield9-Sep-04 20:00 
One note - I had to add
 
#ifndef IDC_HAND
#define IDC_HAND MAKEINTRESOURCE(32649)   // From WINUSER.H
#endif
at the beginning of XScrollBar.cpp
 
Steve
GeneralRe: As soon as I saw it...memberHans Dietrich9-Sep-04 20:10 
Thanks, Steve.

GeneralRe: As soon as I saw it...memberSteve Mayfield9-Sep-04 21:52 
I just about have the vertical scroll function working...should be finished soon. I'll let you know so you can post an update.
 
Steve
GeneralYou have just earned another 5 :)memberGilad Novik9-Sep-04 16:20 
Smile | :)
 
Whoa! The internet is even on computers now!
GeneralRe: You have just earned another 5 :)memberGMorris19-Sep-04 7:15 
Gilad Novik wrote:
Whoa! The internet is even on computers now!
 
Now, what the hell is that supposed to mean?
 
Gary W. Morris, Entepreneur
GeneralRe: You have just earned another 5 :)memberGilad Novik19-Sep-04 7:25 
It's a blonde's saying... Wink | ;)
 
Whoa! The internet is even on computers now!
GeneralRe: You have just earned another 5 :)memberGMorris19-Sep-04 7:38 
Whatever..........
 
Gary W. Morris, Entepreneur
GeneralHansmembernorm.net9-Sep-04 9:52 
Nice work 5/5, gotta luv the detail you put into the article.

GeneralRe: HansmemberNeville Franks9-Sep-04 11:15 
norm.net wrote:
Nice work 5/5, gotta luv the detail you put into the article.
 
Agreed. 5 from me 2.
 
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
 

GeneralRe: HansmemberIgor Vigdorchik9-Sep-04 12:16 
Agree. Great article, 5 from me.
GeneralBeautiful! Now I gotta find a use for thismemberAbu Mami9-Sep-04 8:43 
Really nice little control you cooked up. My problem is that I have absolutely no need for this. I'll have to give it some thought, but none of my current or upcoming projects need a scroll bar. Bummer Frown | :-(
GeneralOh, yeah, almost forgot...memberAbu Mami9-Sep-04 18:00 
You got my 5! Brilliant.
GeneralUse control in VB .NetmemberArkady Lesniara9-Sep-04 8:43 
The control looks great. One question though: is there a way to use it in VB .Net? How? Thx.
GeneralRe: Use control in VB .NetmemberWREY11-Sep-04 10:00 
Why not go to a VB.Net website and ask the question? That seems to be a good place!!
 
Poke tongue | ;-P
 
William
 
Fortes in fide et opere!
GeneralRe: Use control in VB .NetmemberGMorris19-Sep-04 7:30 

It should work just like any other unmanaged code. Maybe a wrapper class or something, use your imagination...

 
Gary W. Morris, Entepreneur
GeneralRe: Use control in VB .NetmemberArkady Lesniara20-Sep-04 3:48 
Thnaks for your reply. That's what I thought. I just figured that the C++ guys would know better than me how to package it into a dll.
Thanks again.
GeneralRe: Use control in VB .NetmemberAsaph14-Oct-04 9:19 
Follow this link:
http://www.codeproject.com/vb/net/LiuCoolScrollBar.asp[^]
Smile | :)
 
Pablo Robert

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130617.1 | Last Updated 2 Sep 2008
Article Copyright 2004 by Hans Dietrich
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid