Jump to content

Slider Control SetThumbWidth


Recommended Posts

Is it possible to set the Width of the Pointer of a slider control.

There is a _GUICtrlSlider_SetThumbLength() function to make it longer but I would like to make it fatter.

It's for use on a touch screen so I need a chunkier area to touch down on.

Thanks

Chris

Link to comment
Share on other sites

Link to comment
Share on other sites

_GUICtrlSlider_SetThumbLength() makes it generally bigger, but with the 1:2 ratio (or whatever it is), it's not really satisfying.

#Include <GuiSlider.au3>

$gui = GUICreate("test 2", 800, 480)

$slider1 = GUICtrlCreateSlider(0, 0, 800, 110, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_FIXEDLENGTH))
_GUICtrlSlider_SetThumbLength(GUICtrlGetHandle($slider1), 100)

DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($slider1), "wstr", 0, "wstr", 0)

GUISetState()

Do
Until GUIGetMsg() = -3

I'm starting to think it's best to create your own slider control.

Link to comment
Share on other sites

I was thinking of pining a pic on top of the slide controller to handle the issue, but I'm not sure on how to do it.

I did a bit of googling and found this...

void CTestSlider::OnPaint()
{
//CPaintDC dc(this); // device context for painting

// TODO: Add your message handler code here

//It said not to call this, but I need to so the control shows up
//so that I can paste the bitmaps in the correct places
CSliderCtrl::OnPaint();

CDC* pDC = this-&gt;GetDC();
CDC memDC2;
CDC memDC;
CRect rect;
CRect rect2;
CRect thumb;
CBitmap* pOldBitmap2;
CBitmap* pOldBitmap;


//Get the rect of the thumb control
GetThumbRect(thumb);
//Get the rect of the client part of the control
GetClientRect(rect);
//Get another rect of the client part of control
GetClientRect(rect2);



//capture top left coords of thumb control
CPoint point = thumb.TopLeft();
memDC2.CreateCompatibleDC(pDC);
pOldBitmap2 = memDC2.SelectObject(&bitmap2);
//paste bitmap onto the client area of control
pDC-&gt;BitBlt(0,0,rect2.Width(), rect2.Height(), &memDC2, 0,0, SRCCOPY);

memDC.CreateCompatibleDC(pDC);
pOldBitmap = memDC.SelectObject(&bitmap);
//paste bitmap onto thumb control of control
pDC-&gt;BitBlt(point.x-2,point.y, thumb.Width()+4, thumb.Height(), &memDC, 0, 0, SRCCOPY);


memDC2.SelectObject(pOldBitmap2);
memDC.SelectObject(pOldBitmap);

// Do not call CSliderCtrl::OnPaint() for painting messages

}

But I'm affraid I really don't understand it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...