FoxPro/Visual FoxPro - Mover un Formulario

 
Vista:

Mover un Formulario

Publicado por Gabriel (3 intervenciones) el 06/06/2014 21:27:17
Estimados amigos :

Necesito mover un formulario que no tienen la Barra de Titulo mediante el mouse.

He encontrado 2 codigos en la WEB pero algo les falta o estan incompletos porque no se puede mover el formulario...

Aqui los codigos :

1 ) Para realizar esto agreguémosle al formulario las propiedades ejex, ejey, mdown.

En el evento MouseMove del form agregamos lo siguiente :

With thisform
If thisform.MDown Then
ThisForm .Left = ThisForm .Left + nXCoord - .ejex
ThisForm .Top = ThisForm .Top + nYCoord - .ejey
EndIf
EndWith

En el evento MouseDown del form agregamos lo siguiente
ThisForm.MDown = .F.

En el evento MouseDown del form agregamos lo siguiente
Thisform.MDown = .T.
Thisform.ejex = nXCoord
Thisform.ejey = nYCoord

2) Se Crea un metodo llamado Mover_Ventana

LPARAMETERS nXCoord, nYCoord
WITH ThisForm
DO WHILE MDown()
.Move(.Left + MCol(.Name, 3) - nXCoord, .Top + MRow(.Name, 3) - nYCoord)
ENDDO
Endwith
Return

Y en evento MouseMovet :

LPARAMETERS nButton, nShift, nXCoord, nYCoord
ThisForm.Mover_Ventana(nXCoord, nYCoord)
RETURN

Ambos No funcionan correctamente...

Me podrian ayudar a encontrar la solucion..

Saludos,

INTEGRAL
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Mover un Formulario

Publicado por Ernesto Hernandez (4623 intervenciones) el 16/07/2014 00:21:03
Gabriel prueba esto ......

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
PUBLIC oform1
 
oForm1 = NEWOBJECT("form1")
oForm1.Show()
RETURN
 
DEFINE CLASS form1 AS form
 
	Autocenter = .T.
	Height = 250
	Width = 375
	TitleBar = 0
	Name = "Form1"
 
	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 192, Left = 132, Height = 27, Width = 84, ;
		Caption = "Exit", Name = "Command1"
 
	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 84, Left = 48, Height = 27, Width = 84, ;
		Caption = "Command2", SpecialEffect = 2, Name = "Command2"
 
	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 84, Left = 252, Height = 27, Width = 84, ;
		Caption = "Command3", SpecialEffect = 2, Name = "Command3"
 
	PROCEDURE Load
		DECLARE Long ReleaseCapture IN WIN32API
		DECLARE Long SendMessage IN WIN32API ;
				Long HWND, Long wMsg, Long wParam, Long Lparam
	ENDPROC
 
	PROCEDURE MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		#DEFINE WM_SYSCOMMAND 0x112
		#DEFINE WM_LBUTTONUP 0x202
		#DEFINE MOUSE_MOVE 0xf012
 
		IF nButton = 1 		&& LMB
			= ReleaseCapture()
			* Complete left click by sending 'left button up' message
			= SendMessage(Thisform.HWnd, WM_LBUTTONUP, 0x0, 0x0)
			* Initiate Window Move
			= SendMessage(Thisform.HWnd, WM_SYSCOMMAND, MOUSE_MOVE, 0x0)
		ENDIF
	ENDPROC
 
	PROCEDURE command1.Click
		Thisform.Release()
	ENDPROC
 
ENDDEFINE

Suerte !!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar