Shordi 27-06-2024, 18:31
Me lo han pedido en Youtube y he vuelto a hacer lo que ya hice en su día: Cómo crear un componente propio para enlazar nuestros controles con todos nuestros programas que los necesiten.



Saludos
vuott 27-06-2024, 01:03
Hola,
aquí un posible código para la realización de un Confused pseudo-Slider con tres indicadores de valor:

Código:
Private DrawingArea1 As DrawingArea
Private bt1 As Button
Private bt2 As Button
Private bt3 As Button
 
 
Public Sub Form_Open()
 
 With DrawingArea1 = New DrawingArea(Me) As "DrawingArea1"
   .X = 20
   .Y = 20
   .W = 310
   .H = 20
   .Border = Border.Solid
 End With
 
 With bt1 = New Button(DrawingArea1) As "BT"
   If Not Even(DrawingArea1.W * 0.03) Then .W = (DrawingArea1.W * 0.03) + 1
   .H = DrawingArea1.H
   .X = 0
   .Y = 0
   .Text = String.Chr(&2193)
 End With
 With bt2 = New Button(DrawingArea1) As "BT"
   .W = bt1.W
   .H = DrawingArea1.H
   .X = DrawingArea1.W - (DrawingArea1.W / 2)
   .Y = 0
   .Text = String.Chr(&2193)
 End With
 With bt3 = New Button(DrawingArea1) As "BT"
   .W = bt1.W
   .H = DrawingArea1.H
   .X = DrawingArea1.W - .W
   .Y = 0
   .Text = String.Chr(&2193)
 End With
 Me.Title = "Min = " & CStr(bt1.X) & "   Med =" & CStr(bt2.X) & "   Max =" & CStr(bt3.X)
 
End
 
Public Sub DrawingArea1_Draw()
 
 With Paint
   .Brush = Paint.Color(Color.Green)
   .Rectangle(bt1.X + bt1.W, 0, (DrawingArea1.W - bt1.X) - (DrawingArea1.W - bt2.X), DrawingArea1.H)
   .Fill
   .Brush = Paint.Color(Color.Orange)
   .Rectangle(bt2.X + bt2.W, 0, (DrawingArea1.W - bt2.X) - (DrawingArea1.W - bt3.X), DrawingArea1.H)
   .Fill
   .End
 End With
  
End
 
Public Sub BT_MouseMove()
 
 With Last
   .X = .X + Mouse.X - Mouse.StartX
   .Y = .Y + Mouse.Y - Mouse.StartY
 End With
 
 If Last.Y <> 0 Then Last.Y = 0
  
 Select Case Last.Id
   Case bt1.Id
     If bt1.X < 0 Then bt1.X = 0
     If bt1.X > bt2.X - bt1.W Then bt1.X = bt2.X - bt1.W
   Case bt2.Id
     If bt2.X < (bt1.X + bt1.W) Then bt2.X = bt1.X + bt1.W
     If (bt2.X + bt2.W) > bt3.X Then bt2.X = bt3.X - bt2.W
   Case bt3.Id
     If bt3.X < (bt2.X + bt2.W) Then bt3.X = bt2.X + bt2.W
     If (bt3.X + bt3.W) > DrawingArea1.W Then bt3.X = DrawingArea1.W - bt3.W
 End Select
 
 DrawingArea1.Refresh

 Me.Title = "Min = " & CStr(bt1.X) & "   Med = " & CStr(bt2.X) & "   Max = " & CStr(bt3.X)
 
End
Europaei sumus !
Shordi 26-06-2024, 20:00
El control no es nuevo, lo hice hace el suficiente tiempo como para haber olvidado por completo cómo funcionaba. Menos mal que aunque he perdido la memoria aún se leer el código y ponerme al día fácilmente. A petición, le he añadido un comportamiento nuevo. Antes sólo buscaba y ahora filtra.
Una imagen vale más que mil palabras para el caso y un vídeo ni te cuento, aquí tenéis la demo:



Los enlaces de descarga del código fuente del vídeo:

https://drive.google.com/file/d/1_qWJ9Cm...sp=sharing

y, naturalmente, lo podéis bajar siempre en la última versión aquí:

https://gitlab.com/shordi/ComboSeek

Saludos
Páginas (573):    1 87 88 89 90 91 573   
Bienvenido, Invitado
Tienes que registrarte para poder participar en nuestro foro.
Recordarme?
Miembros: 314
Último miembro: LKTFermin2
Temas del foro: 1,769
Mensajes del foro: 9,182
Últimos temas
Programando con la IA
Foro: General
Último mensaje por: seta43, 30-07-2026, 12:20
Respuestas: 12 - Vistas: 7,672
GauchoCAD vuelve a las pi...
Foro: Aplicaciones/Fragmentos de Código
Último mensaje por: tincho, 27-07-2026, 14:15
Respuestas: 15 - Vistas: 20,869
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.