Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I move a screen by using MOUSEDOWN?
Message
De
26/04/2013 12:53:41
 
 
À
26/04/2013 12:03:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01571991
Message ID:
01572000
Vues:
46
>I have a form (dialog) withut a title bar
>how can I allow users to move the form?
>
>I have this in the form's MouseDown event:
>
>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>
>thisform.nMouseX = nXCoord
>thisform.nMouseY = nYCoord
>
>
>this does not get executed when i click on the form itself!


Put a transparent shape on your form behind everything and trap the movement on there.

You need to use the MouseMove event and trap the condition of the nButton being down.

Perhaps a better way to do it is to trap the MouseDown event on your form somewhere where there is no other event that's triggered, and then monitor MouseMove to see if the user is left-clicking for more than a few pixels. If so, then BINDEVENT(thisForm.hwnd, WM_MOUSEMOVE, thisForm, "myCustomMouseMoveEvent") and monitor those locations. Use the Windows function GetAsyncKeyState() to read the mouse button state (http://msdn.microsoft.com/en-us/library/windows/desktop/ms646293%28v=vs.85%29.aspx) and GetCursorPos() to find out where the mouse is on the entire desktop (http://msdn.microsoft.com/en-us/library/windows/desktop/ms648390%28v=vs.85%29.aspx) and then begin reading mouse deltas from the original location and position your form adjusted by those deltas from its original position.

Once the mouse button is released, UNBINDEVENT().
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform