Very simple question about HScrollbar

  • Thread starter Thread starter Sahil Malik
  • Start date Start date
S

Sahil Malik

I am making a user control.

It has a Hscrollbar,
and a label.

and I have a piece of code that links them together as -
private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
label1.Text = hScrollBar1.Value.ToString() ;
}

(Also the relevant event handler) .... Sounds pretty simple huh?

Except, the Maximum Value of my scrollbar is 100, but the damn thing won't
scroll beyond 91.

Please help.

- Sahil Malik
Independent Consultant
You can reach me thru my blog - http://dotnetjunkies.com/WebLog/sahilmalik/
 
* "Sahil Malik said:
I am making a user control.

It has a Hscrollbar,
and a label.

and I have a piece of code that links them together as -
private void hScrollBar1_Scroll(object sender,
System.Windows.Forms.ScrollEventArgs e)
{
label1.Text = hScrollBar1.Value.ToString() ;
}

(Also the relevant event handler) .... Sounds pretty simple huh?

Except, the Maximum Value of my scrollbar is 100, but the damn thing won't
scroll beyond 91.

That's by design:

<URL:http://groups.google.com/groups?selm=CCWfEOXzCHA.1192@cpmsftngxa08>
 
When you think of "Maximum" do you think of "Maximum" or "Maximum -
LargeChange + 1". (Badly documented, this is mentioned in the fine print
only)
Also, the scrollbar in datagrids work different, they are "Maximum -
LargeChange". (Not documented at all).

So next time when you ask for a pitcher of beer, I will give you a pitcher
minus a glass plus a peg, but if you order your beer programatically, then
you get a full pitcher.

- Sahil Malik
Independent Consultant
You can reach me thru my blog at -
http://www.dotnetjunkies.com/weblog/sahilmalik/
 
Back
Top