Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The missing mouse pointer
Message
 
À
10/03/2006 09:10:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01103072
Message ID:
01103326
Vues:
13
>I have a form with a map on it. I want to create an animated mouse pointer. The pointer would be crosshairs from each edge of the form to the other and from top to bottom, much like the cursor used for drafting programs. Can this be done in VFP or will the redrawing of the lines as the cursor moves erase the map underneath? If it can be done, how?


May be this helps you get started?
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (x:\foxv\hugo\prog\testcrosshairs.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   03/10/06 04:06:01 PM
*
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 395
	Width = 396
	DoCreate = .T.
	Caption = "Form1"
	*-- XML Metadata for customizable properties
	_memberdata = ""
	Name = "Form1"


	ADD OBJECT crosshaircontainer1 AS crosshaircontainer WITH ;
		Top = 25, ;
		Left = 63, ;
		Width = 282, ;
		Height = 172, ;
		Name = "Crosshaircontainer1", ;
		vLine.Name = "vLine", ;
		hLine.Name = "hLine"


	ADD OBJECT image1 AS image WITH ;
		Anchor = 15, ;
		Picture = "c:\program files\microsoft visual foxpro 9\graphics\metafiles\business\laptop1.wmf", ;
		Stretch = 2, ;
		Height = 264, ;
		Left = 20, ;
		Top = 45, ;
		Width = 334, ;
		Name = "Image1"

	PROCEDURE Init
		this.crosshaircontainer1.Top	= thisform.image1.Top
		this.crosshaircontainer1.Left	= thisform.image1.Left
		this.crosshaircontainer1.Width	= thisform.image1.Width
		this.crosshaircontainer1.Height	= thisform.image1.Height
		this.crosshaircontainer1.Anchor	= thisform.Image1.Anchor
		this.crosshaircontainer1.ZOrder(0)
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************

**************************************************
*-- Class:        crosshaircontainer (x:\foxv\hugo\prog\test.vcx)
*-- ParentClass:  container
*-- BaseClass:    container
*-- Time Stamp:   03/10/06 04:06:14 PM
*
DEFINE CLASS crosshaircontainer AS container


	Anchor = 0
	Width = 200
	Height = 200
	BackStyle = 0
	BorderWidth = 0
	MousePointer = 2
	*-- XML Metadata for customizable properties
	_memberdata = ""
	Name = "crosshaircontainer"


	ADD OBJECT vline AS line WITH ;
		DrawMode = 5, ;
		Enabled = .F., ;
		Height = 100, ;
		Left = 98, ;
		MousePointer = 99, ;
		Top = 3, ;
		Visible = .F., ;
		Width = 0, ;
		BorderColor = RGB(128,128,128), ;
		Name = "vLine"


	ADD OBJECT hline AS line WITH ;
		DrawMode = 5, ;
		Enabled = .F., ;
		Height = 0, ;
		Left = 30, ;
		MousePointer = 99, ;
		Top = 43, ;
		Visible = .F., ;
		Width = 127, ;
		BorderColor = RGB(128,128,128), ;
		Name = "hLine"


	PROCEDURE MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord

		with this
			.vLine.Visible		= .F.
			.hLine.Visible		= .F.
		endwith

		Dodefault(nButton, nShift, nXCoord, nYCoord)
	ENDPROC


	PROCEDURE MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord

		with this
			with .vLine
				.Height					= this.Height
				.Width					= 0
				.Left					= nXCoord - Objtoclient(this, 2)
				.Visible				= .T.
			endwith
			with .hLine
				.Left					= 0
				.Width					= this.Width
				.Top					= nYCoord - Objtoclient(this, 1)
				.Visible				= .T.
			endwith
		endwith

		Dodefault(nButton, nShift, nXCoord, nYCoord)
	ENDPROC


	PROCEDURE MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord

		with this
			.vLine.Left				= nXCoord - Objtoclient(this, 2)
			.hLine.Top				= nYCoord - Objtoclient(this, 1)
		endwith

		Dodefault(nButton, nShift, nXCoord, nYCoord)
	ENDPROC


ENDDEFINE
*
*-- EndDefine: crosshaircontainer
**************************************************
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform