469,609 Members | 1,933 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Change scroller size

Dear all,
imagine this is scroll bar.
Min|-------------|scroller|---------|Max
The position of scroller is set with Value.
How do I change the width of scroller?
Thank you in advance,
Boni
Nov 21 '05 #1
8 2265
the width of the thumb (what you call the scroller) is dynamically set based
on the min and max size. It's not something you want to just change because
its determined automatically what size it should be in windows. You can
change it using API calls but it is a little pointless.

"Boni" <oilia@nospam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Dear all,
imagine this is scroll bar.
Min|-------------|scroller|---------|Max
The position of scroller is set with Value.
How do I change the width of scroller?
Thank you in advance,
Boni

Nov 21 '05 #2
Hi Brian
on the min and max size. It's not something you want to just change
because its determined automatically what size it should be in windows.

But how is it determinated? In dependency of what?
Thanks,
Boni
Nov 21 '05 #3
"Boni" <oilia@nospam> schrieb:
on the min and max size. It's not something you want to just change
because its determined automatically what size it should be in windows.

But how is it determinated? In dependency of what?


The width of the thumb for horizontal scrollbars depends on the value of the
scrollbar's 'LargeChange' property too. The code below demonstrates how to
approximately calculate the width of the thumb for an horizontal scrollbar.
To test the sample, place a button control and an horizontal scrollbar on
the form and add the code below to the button's 'Click' event. After
pressing the button it will be moved below the scrollbar and its width will
be approximately equal to the scrollbar's thumb's width (note that the code
was written from scratch!):

\\\
Me.Button1.Left = _
Me.HScrollBar1.Left + SystemInformation.HorizontalScrollBarHeight
Me.Button1.Top = _
Me.HScrollBar1.Top + Me.HScrollBar1.Height
Me.Button1.Width = _
CInt( _
Me.HScrollBar1.LargeChange * _
( _
Me.HScrollBar1.Width - 2 * _
SystemInformation.HorizontalScrollBarHeight _
) / 100 _
)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4
Hi Herfried,
thank you very much.
Just one more question
The width of the thumb for horizontal scrollbars depends on the value of
the scrollbar's 'LargeChange' property too.

This "too" what does it mean. If I understand you correctly it depoends on
Minimum, Maximum and LargeChange property ONLY? Or is there some other
things?
And thanks for your code.
Boni
Nov 21 '05 #5
"Boni" <oilia@nospam> schrieb:
The width of the thumb for horizontal scrollbars depends on the value of
the scrollbar's 'LargeChange' property too.
This "too" what does it mean.


It only means that 'LargeChange' is an additional dependency.
If I understand you correctly it depoends on Minimum, Maximum and
LargeChange property ONLY? Or is there some other things?


It depends on the width of the scrollbar (for horizontal scrollbars) too
;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6
Now I am really confused:
You give following formula:
TumbWidth= CInt( Me.HScrollBar1.LargeChange * (
Me.HScrollBar1.Width - 2 *
stemInformation.HorizontalScrollBarHeight ) / 100
I need to have formula to LargeChange for given ThumbWidth
LargeChange =TumbWidth*100/( Me.HScrollBar1.Width - 2 *
SystemInformation.HorizontalScrollBarHeight )

Now I want to have Tumb as a 10-th of width and looking for large change:
LargeChange =( (Me.HScrollBar1.Width - 2 *
SystemInformation.HorizontalScrollBarHeight )/10)*100/(
Me.HScrollBar1.Width - 2 *
stemInformation.HorizontalScrollBarHeight )=10. So it does not depend on
Minimum and maximum.
Unfortunately tests shows that my formula is wrong :(.
Did I missed something or is your formula incorrect too?

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP14.phx.gbl...
"Boni" <oilia@nospam> schrieb:
The width of the thumb for horizontal scrollbars depends on the value of
the scrollbar's 'LargeChange' property too.


This "too" what does it mean.


It only means that 'LargeChange' is an additional dependency.
If I understand you correctly it depoends on Minimum, Maximum and
LargeChange property ONLY? Or is there some other things?


It depends on the width of the scrollbar (for horizontal scrollbars) too
;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7
"Boni" <oilia@nospam> schrieb:
Now I want to have Tumb as a 10-th of width and looking for large change:
LargeChange =( (Me.HScrollBar1.Width - 2 *
SystemInformation.HorizontalScrollBarHeight )/10)*100/(
Me.HScrollBar1.Width - 2 *
Information.HorizontalScrollBarHeight )=10. So it does not depend on
Minimum and maximum.
Unfortunately tests shows that my formula is wrong :(.
Did I missed something or is your formula incorrect too?


The width of the thumb depends on the difference between the maximum and the
minimum in relation to the large change interval.

\\\
Me.HScrollBar1.LargeChange = _
(Me.HScrollBar1.Maximum - Me.HScrollBar1.Minimum) \ 10
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #8
Thank you very much for your time.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:uO**************@TK2MSFTNGP11.phx.gbl...
"Boni" <oilia@nospam> schrieb:
Now I want to have Tumb as a 10-th of width and looking for large change:
LargeChange =( (Me.HScrollBar1.Width - 2 *
SystemInformation.HorizontalScrollBarHeight )/10)*100/(
Me.HScrollBar1.Width - 2 *
rmation.HorizontalScrollBarHeight )=10. So it does not depend on
Minimum and maximum.
Unfortunately tests shows that my formula is wrong :(.
Did I missed something or is your formula incorrect too?


The width of the thumb depends on the difference between the maximum and
the minimum in relation to the large change interval.

\\\
Me.HScrollBar1.LargeChange = _
(Me.HScrollBar1.Maximum - Me.HScrollBar1.Minimum) \ 10
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Razvan | last post: by
3 posts views Thread by Alex D. | last post: by
8 posts views Thread by marco | last post: by
14 posts views Thread by mistral | last post: by
14 posts views Thread by Mars | last post: by
9 posts views Thread by John | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.