|
-
May 8th, 2002, 09:23 PM
#1
Thread Starter
Lively Member
stretching the line object...
I have to write a program that moves the button of a horizontal scrollbar, then stretches a line objetct to match the value property of the scrollbar button. I wrote code for it and it is running, but it looks like the line is stretching much further than the value of the scrollbar button. Am I doing this right?
Here is the code:
Private Sub HScroll1_Change()
Dim x1 As Single, x2 As Single
HScroll1.Value = HScroll1.Max
Line1.x2 = Line1.x1 + HScroll1.Value
End Sub
-
May 8th, 2002, 09:31 PM
#2
VB Code:
Private Sub HScroll1_Change()
Line1.x2 - Line1.x2 + HScroll1.value
End Sub
-
May 8th, 2002, 11:05 PM
#3
VB Code:
Private Sub HScroll1_Change()
' Set line to left edge of scroll bar.
Line1.X1 = HScroll1.Left
' Set right edge of line based on value of scroll bar.
' Calculation: Width of the scroll bar is divided
' by the number of values in the scroll bar (max-min).
' This returns the number of units available for the line.
' Multiply this by the scroll bar vule to set line length.
Line1.X2 = Line1.X1 + ((HScroll1.Width / (HScroll1.Max - HScroll1.Min)) * HScroll1.Value)
End Sub
The line won't match up exactly to the positionof the scroll bar thumb. It will be to the left for lower numbers and tothe right for higher. This is because the line length is the length of the whole scroll bar, including the left/right arrow buttons.
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
|