Results 1 to 3 of 3

Thread: stretching the line object...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    65

    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

  2. #2
    Stiletto
    Guest
    VB Code:
    1. Private Sub HScroll1_Change()
    2. Line1.x2 - Line1.x2 + HScroll1.value
    3. End Sub

  3. #3
    WorkHorse
    Guest
    VB Code:
    1. Private Sub HScroll1_Change()
    2.    
    3.     ' Set line to left edge of scroll bar.
    4.     Line1.X1 = HScroll1.Left
    5.    
    6.     ' Set right edge of line based on value of scroll bar.
    7.     ' Calculation: Width of the scroll bar is divided
    8.     ' by the number of values in the scroll bar (max-min).
    9.     ' This returns the number of units available for the line.
    10.     ' Multiply this by the scroll bar vule to set line length.
    11.     Line1.X2 = Line1.X1 + ((HScroll1.Width / (HScroll1.Max - HScroll1.Min)) * HScroll1.Value)
    12.  
    13. 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
  •  



Click Here to Expand Forum to Full Width