Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/10/2005, 11:15
Avatar de David
David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
De acuerdo

Cita:
Iniciado por vats
Asi es David


Que unicamente pueda desplazarse dentro del formulario y si intento moverlo mas alla no lo pueda hacer ya sea para arriba, abajo un lado ó el otro
Así pana:
Código:
 
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type
Private Declare Sub ClipCursor Lib "user32" (lpRect As Any)
Sub CursorLiberate()
Dim Client As RECT
Client.Top = 0
Client.Bottom = InPixelsY(Screen.Height)
Client.Left = 0
Client.Right = InPixelsX(Screen.Width)
ClipCursor Client
End Sub
Sub CursorLimit()
Dim Client As RECT
Client.Top = InPixelsY(Top)
Client.Bottom = InPixelsY(Top) + InPixelsY(Height)
Client.Left = InPixelsX(Left)
Client.Right = InPixelsX(Left) + InPixelsX(Width)
ClipCursor Client
End Sub
Function InPixelsX(ByVal TwipsX As Long) As Long
InPixelsX = TwipsX / Screen.TwipsPerPixelX
End Function
Function InPixelsY(ByVal TwipsY As Long) As Long
InPixelsY = TwipsY / Screen.TwipsPerPixelY
End Function
Private Sub cmdEnd_Click()
Unload Me
End Sub
Private Sub Form_Load()
BorderStyle = 0
End Sub
Private Sub Form_Resize()
CursorLimit
End Sub
Private Sub Form_Unload(Cancel As Integer)
CursorLiberate
End Sub
Le puse que sea BorderStyle=0 porque funciona mejor (y el botón lógicamente que ya lo sabrás... )
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.