Hi. I am trying to make a Vscroll type OCX. I have everything finished except figuring out how to drag the slider with the mouse and have it figure its place on the bar and turn that into a value between the minimum which is usualy 0 and the Max which could be anything but is set to 500 for this example.
I can drag the slider img up and down no problem. But figuring out the math to get the Value of the slider is hard. I've tried using the .top property divided by the Userontrol.height etc... and can't get anything reliebale.
I have attached a small .jpg so you can see the control and get an idea of what i am talking about.
Here is an idea of the code i am using as well.
VB Code:
Private Sub imgSLIDER_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then imgSLIDER.Move imgSLIDER.Left - 0, imgSLIDER.Top - (prevY - Y) m_Value = imgSLIDER.Top - Usercontrol.Height - ImgUP.Height - imgSLIDER.Height - ImgDOWN.Height / m_Max / 2 RaiseEvent Scroll End If End Sub
m_Value is the current value of the slider which is somewhere between the M_Min and M_Max values 0-500 for this example.
Imgup, ImgDown and ImgSlider are the 3 images on the control.
THanks alot for any help!
:D :D :D :D :D :D
