Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: cheatmaster en 11 Diciembre 2008, 02:08 am



Título: Mousemove
Publicado por: cheatmaster en 11 Diciembre 2008, 02:08 am
Hola miren:

Código:
Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label4.Visible = True


End Sub

Eso mostraria al pasar por encima el label4, como se hace para si "sale el raton" del label4 desaparezca ??

Prove con MouseLeave y nada


Título: Re: Mousemove
Publicado por: seba123neo en 11 Diciembre 2008, 02:37 am
Hola, no existe el MouseLeave, de ultima ponelo en el Form_Mousemove para que mientras pases el mouse sobre el formulario no se vea...

saludos.


Título: Re: Mousemove
Publicado por: byway en 11 Diciembre 2008, 04:26 am
MouseLeave no existe ...solo MouseMove, MouseUp, MouseDown...

y la sugerencia de seba me parece bien ...

ahora que recuerdo tengo un detalle que me pasa con eso del Form_MouseMove.. en mi aplicacion, ya pongo un post sobre ello.


Título: Re: Mousemove
Publicado por: cheatmaster en 11 Diciembre 2008, 18:26 pm
Gracias, no lo había pensado  ;D


Título: Re: Mousemove
Publicado por: Dessa en 11 Diciembre 2008, 18:43 pm
MouseLeave "rebuscado" para Label (para text seria mas directo por el Hwn)

Código:

Option Explicit

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI
    X As Long
    Y As Long
End Type

Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long

Private Type RECT
    left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Private Sub Form_Load()

Text1.Appearance = Label1.Appearance
Text1.BorderStyle = Label1.BorderStyle
Text1.Top = Label1.Top
Text1.left = Label1.left
Text1.Height = Label1.Height
Text1.Width = Label1.Width

Text1.Visible = False

Label1.BackColor = vbBlack
Label1.ForeColor = vbWhite
Label1.Alignment = 2
Label1.FontBold = True

Timer1.Interval = 50

End Sub

Private Sub Timer1_Timer()

Dim TR1 As RECT
Dim TR2 As RECT

Dim Left1 As Integer
Dim Left2 As Integer
Dim Top1 As Integer
Dim Top2 As Integer

Dim Point As POINTAPI

GetCursorPos Point

Call GetWindowRect(Text1.hwnd, TR1)
Call GetClientRect(Text1.hwnd, TR2)

Left1 = TR1.left
Left2 = TR1.left + (Label1.Width / 15)
Top1 = TR1.Bottom - TR2.Bottom
Top2 = TR1.Bottom - TR2.Bottom + (Label1.Height / 15)

If Point.X > Left1 And Point.X < Left2 And Point.Y > Top1 And Point.Y < Top2 Then
Label1.BackColor = vbRed
Else
Label1.BackColor = vbBlack
End If

End Sub


Nota: puede servir tambien para saber si en una aplicacion externa a la nuestra  estan pasando el mouse sobre un control .

Saludos