|
-
Nov 14th, 2000, 03:27 PM
#1
Thread Starter
Frenzied Member
is it possible for me to make my own slider bar control using a label?
NXSupport - Your one-stop source for computer help
-
Nov 14th, 2000, 03:35 PM
#2
Hyperactive Member
-
Nov 14th, 2000, 03:36 PM
#3
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Nov 14th, 2000, 03:37 PM
#4
Hyperactive Member
Garbage in Garbage out. You didn't specify a problem!
-
Nov 14th, 2000, 03:40 PM
#5
Thread Starter
Frenzied Member
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
-
Nov 14th, 2000, 04:58 PM
#6
Hyperactive Member
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.
-
Nov 14th, 2000, 05:27 PM
#7
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|