|
-
Feb 13th, 2004, 03:45 PM
#1
.NET scroll bars-> when you scroll them to maximum position scroll.value is not max
what the heck, I dont understand this at all. I opened a blank project, added two scroll bars, each having a minimum value of 0 and a maximum value of a 100. when I run the program, and I scroll the scrollbars to the maximum value position, it appears that scrollbar.value never goes any higher than 91....
VB Code:
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Me.Text = HScrollBar1.Value.ToString
End Sub
Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Me.Text = VScrollBar1.Value.ToString
End Sub
would someone try the same thing and see is this happens to you too? because this totally doesnt make any sense to me
Last edited by MrPolite; Feb 13th, 2004 at 09:07 PM.
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 14th, 2004, 05:38 PM
#2
-
Feb 14th, 2004, 07:36 PM
#3
uuh this is stupid, a big part of my app depends on this scrollbar controls. What the heck!
Maybe we are doing something wrong? Because it's hard to believe that these controls that have been used over years have a bug
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 14th, 2004, 11:08 PM
#4
Nothing wrong with the control, it was designed this way
See why?
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Feb 15th, 2004, 02:01 PM
#5
Hi.
I do not agree that it was designed that way...
It seems like MS thought it was easier to write a note than to fix the bug.
Why would they design it that way anyway? I mean, what is it good for?
VB6 wasn't designed like that...
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 15th, 2004, 03:02 PM
#6
uuh huh?! what the hell? I agree with pax, I see absolutly no reason whatsoever why someone would NEED to have the scroll bars that way. I don't see any reason why anyone wouldnt want a properly working scrollbar control. Microsoft is stupid
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 15th, 2004, 03:08 PM
#7
If you set the scrollbars.LargeChange Value to 1 then it will fix your problem.
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Feb 15th, 2004, 03:23 PM
#8
Originally posted by <ABX
If you set the scrollbars.LargeChange Value to 1 then it will fix your problem.
well there is a problem with that. The LargeChange property has cetainly a purpose and setting it to 1 all the time would ruin its purpose. When the user clicks on a point on the scrollbar, he/she expects the scrollbar to "jump" to that point, and with the LargeChange set to 1 the scrollbar would only change a tad bit instead of having a large change.
I would fix it if there was a way to somehow figure out when the user clicks on the up and down arrows on the scrollbar, and when on other parts of the scrollbar, but apparently there isnt a way to do that either
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 15th, 2004, 04:17 PM
#9
Hi MrPolite
You can use this inherited class instead of the real scrollbar.
VB Code:
Public Class MyScroll
Inherits HScrollBar
Dim OldMax As Integer
Public Shadows Property LargeChange() As Integer
Get
Return MyBase.LargeChange
End Get
Set(ByVal Value As Integer)
'To avoid maximum changing when largechange is changed
OldMax = Me.Maximum
MyBase.LargeChange = Value
Me.Maximum = OldMax
End Set
End Property
Public Shadows Property Maximum() As Integer
Get
'Return the REAL max
Return MyBase.Maximum - Me.LargeChange + 1
End Get
Set(ByVal Value As Integer)
'calculate 'virtual' max
MyBase.Maximum = Value + Me.LargeChange - 1
End Set
End Property
Public Sub New()
'Without this the fix won't work with default maximum value
Me.Maximum = MyBase.Maximum
End Sub
End Class
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 16th, 2004, 05:35 PM
#10
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Feb 17th, 2004, 04:24 AM
#11
Hi.
If you are thinking about the scrollbar from the "Grand Ol'e VB6" i think you would need to install the entire VB6. Maybe it's enough to regsvr32 the mscomctl32.dll, but I think there might be a license problem.
Anyway, you could also use the one in MS Forms 2.0. That would require your end user to have MS Office, but it's the only other way that I can think of.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 17th, 2004, 03:36 PM
#12
naah
too much effort needed I'll stick with your version
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 1st, 2015, 04:28 PM
#13
New Member
Re: .NET scroll bars-> when you scroll them to maximum position scroll.value is not m
 Originally Posted by pax
Hi MrPolite
You can use this inherited class instead of the real scrollbar.
VB Code:
Public Class MyScroll
Inherits HScrollBar
Dim OldMax As Integer
Public Shadows Property LargeChange() As Integer
Get
Return MyBase.LargeChange
End Get
Set(ByVal Value As Integer)
'To avoid maximum changing when largechange is changed
OldMax = Me.Maximum
MyBase.LargeChange = Value
Me.Maximum = OldMax
End Set
End Property
Public Shadows Property Maximum() As Integer
Get
'Return the REAL max
Return MyBase.Maximum - Me.LargeChange - Me.Minimum + 1
End Get
Set(ByVal Value As Integer)
'calculate 'virtual' max
MyBase.Maximum = Value + Me.LargeChange + Me.Minimum - 1
End Set
End Property
Public Sub New()
'Without this the fix won't work with default maximum value
Me.Maximum = MyBase.Maximum
End Sub
End Class
Granted this post is old, but it is still relevant. My scroll bar is 1 based and not 0 based.
I was having a problem when I scrolled to max, It would get "Stuck" there until I altered the scroll.value.
So, I made a small tweak to your code, because not ever scrollbar is going to be zero based. So in the get and set I added Me.Minimum to the calculations.
Now even if Minimum is 5, the scrollbar will scroll properly. Thanks for a nice starting point.
And for the coder who was mentioning that the max isn't actually reached until you release the mouse button, It is that way on a standard scrollbar as well.
I always set my Minimum first, so I didn't see the need for shadowing that property.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|