Visual Basic - Problema con un slider

Life is soft - evento anual de software empresarial
 
Vista:

Problema con un slider

Publicado por Westmad (120 intervenciones) el 24/02/2003 18:47:05
Mediante un shape y un image quiero simular un slider.

El shape tiene forma de rectángulo imitando los limites sobre los que se puede deslizar el slider.
El image hace de pestaña del slider.
Mi problema es que no se hacer que se mueva dicho image cuando he apretado el ratón sobre ella y sin soltar, muevo el puntero del ratón.

Haber si me echais una mano. Gracias


Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Problema con un slider

Publicado por kalamar (165 intervenciones) el 26/02/2003 15:16:10
Ahi va un codigo que te va a interesar. En un formulario con un shape y un imagebox pega esto:

Option Explicit

Dim Xpos As Integer

Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Xpos = X
End Sub

Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim NewX As Integer
Dim Porc As Double

If Button > 0 Then
NewX = Image1.Left + X - Xpos

If NewX > Shape1.Left + Shape1.Width - Image1.Width Then NewX = Shape1.Left + Shape1.Width - Image1.Width
If NewX < Shape1.Left Then NewX = Shape1.Left
Image1.Left = NewX

Porc = (Image1.Left - Shape1.Left) * 100 / (Shape1.Width - Shape1.Left - Image1.Width / 2)
Me.Cls
Me.Print Porc
End If
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

No entiendo una cosa...

Publicado por Westmad (120 intervenciones) el 26/02/2003 18:07:11
¿Que significa:

Porc = (Image1.Left - Shape1.Left) * 100 / (Shape1.Width - Shape1.Left - Image1.Width / 2)
Me.Cls
Me.Print Porc
???
De todas formas no me funciona bien, pero agradezco tu ayuda.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar