• Viernes 17 de Mayo de 2024, 06:31

Autor Tema:  Selector de region de una imagen  (Leído 721 veces)

Cyclop

  • Miembro MUY activo
  • ***
  • Mensajes: 323
    • Ver Perfil
    • http://www.geocities.com/icotext/spanish/
Selector de region de una imagen
« en: Domingo 14 de Septiembre de 2003, 21:58 »
0
Hice un cuadro de seleccion pero no me esta funcionando bien, hay dos cosas que no me gustan

1.- Cuando muevo la direccion del cuadro hacia las X o Y negativas a gran velocidad, el posicion X2 empieza a variar de posicion.

2.- Cuando selecciono una region y voy cambiando la dimension del cuadro, este empieza a hacer un repaint de todo el cuadro y se ve el efecto, no me gusta para nada.


Este es el Codigo


Agregar un Shape con el nombre shpSelection
Agregar un JPG al Picture del Formulario

Dim nPosX As Integer
Dim nPosY As Integer

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        nPosX = X
        nPosY = Y
        shpSelection.Top = Y
        shpSelection.Left = X
        shpSelection.Width = 1
        shpSelection.Height = 1
        shpSelection.Visible = True
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If shpSelection.Visible Then
           If X > nPosX Then
              shpSelection.Left = nPosX
              shpSelection.Width = X - nPosX
            Else
              shpSelection.Width = nPosX - X
              shpSelection.Left = X
           End If
           If Y > nPosY Then
              shpSelection.Top = nPosY
              shpSelection.Height = Y - nPosY
            Else
              shpSelection.Height = nPosY - Y
              shpSelection.Top = Y
           End If
        End If
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        shpSelection.Visible = False
End Sub

Salu2

:D -=[Cyclop]=-:D
Icotext Evolution v0.5 para los amantes del ASCII Art
http]