Results 1 to 7 of 7

Thread: Own slider bar

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    is it possible for me to make my own slider bar control using a label?
    NXSupport - Your one-stop source for computer help

  2. #2
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Yes. GIGO

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    whats "GIGO"?
    NXSupport - Your one-stop source for computer help

  4. #4
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Garbage in Garbage out. You didn't specify a problem!

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    i'm trying it so that the user can click on the label, and darg it up or down (not sideways) but to a limited area, like a slide control
    NXSupport - Your one-stop source for computer help

  6. #6
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    Code:
    Option Explicit
    Dim Moving As Boolean
    Dim OldY As Integer
    
    Private Sub Label2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If X >= Label1.Left - Label2.Left And X <= Label1.Width And _
       Y >= Label1.Top - Label2.Top And Y <= Label1.Height + Label1.Top Then
       Moving = True
       OldY = Y
    Else: Moving = False
    End If
    End Sub
    
    Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Moving = True And Y > 0 And Y < Label2.Height Then
        If Label1.Top + Y - OldY >= Label2.Top And _
           Label1.Top + Y - OldY + Label1.Height <= Label2.Top + Label2.Height Then
           Label1.Move Label1.Left, Label1.Top + Y - OldY
        Else
            If Label1.Top + Y - OldY <= Label2.Top Then
                Label1.Move Label1.Left, Label2.Top
            Else
                Label1.Move Label1.Left, Label2.Top + Label2.Height - Label1.Height
            End If
        End If
        OldY = Y
    End If
    End Sub
    
    Private Sub Label2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Moving = False
    End Sub
    To use this properly create two Labels. Label2 is the Length of the slider. Put it in front of the first label (The one thats going to scroll). Make it transparent and change the colour of the first label to something like black.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    thanks a lot
    NXSupport - Your one-stop source for computer help

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