Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Very irregular shape!
Message
 
To
24/03/2005 07:49:35
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8
Miscellaneous
Thread ID:
00989137
Message ID:
00998912
Views:
47
>>>Hi all,
>>>I need to draw an irregular shape (with the mouse); this is easy! I stored the limits (bounderies?) into an array. Not so easy is to treat it as an object, with its backcolor,fillstyle and so on (I must put inside lines, points, color etc.). In other words, I do not know what to do with my array, perhaps it is not the correct way. This 'object' will be finally printed. Some suggest, workaround,will be good to me.
>>>Thanx in advance
>>
>>I do not know of any simple way of doing this, but you'll be glad to hear that what you want to do is very easy to do with VFP 9, so you might want to consider migrating :)
>
>Hi Hugo,
>thank for your reply. I got VFP 9.0 and I tried to do what I wanted to do. But its very difficult to obtain. Once I have the bidimensional array (almost one hundred values) with the nxcoord and nycoord (trapped in the mousemove event), I add the shape object to the form, I make it visible and put this code "thisform.myshape.polypoints='myarray'". Well, nothing appears! Is the shape very shy, or did I something wrong?

After checking what Sergey told you, you must also be sure your shape is "closed" (The coordinates of the first "point" must be the same of the last "point", for example)


[Edit]
Nevermind, I checked and this is not true. I was sure I needed a "closed" set of coordinates, it must've been for something else, so I can not suggest anything other than Sergey's suggestion.
[New Edit]
Ah! what I said is valid when you are using a Line object to create the polygon.
[/New Edit]
[/Edit]
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 (c:\testpoly.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   03/24/05 09:25:10 AM
*
DEFINE CLASS form1 AS form


	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	DIMENSION apoly[1]


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 217, ;
		Left = 282, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Exit", ;
		Name = "Command1"


	ADD OBJECT shape1 AS shape WITH ;
		Top = 15, ;
		Left = 41, ;
		Height = 184, ;
		Width = 313, ;
		FillStyle = 4, ;
		SpecialEffect = 0, ;
		FillColor = RGB(255,0,0), ;
		PolyPoints = "thisform.aPoly", ;
		Name = "Shape1"


	PROCEDURE Init
		with thisform
			dimension .aPoly(6, 2)

			.aPoly[1, 1] = 10
			.aPoly[1, 2] = 5
			.aPoly[2, 1] = 30
			.aPoly[2, 2] = 20
			.aPoly[3, 1] = 40
			.aPoly[3, 2] = 1
			.aPoly[4, 1] = 67
			.aPoly[4, 2] = 75
			.aPoly[5, 1] = 89
			.aPoly[5, 2] = 44
			.aPoly[6, 1] = 10
			.aPoly[6, 2] = 5
		endwith
	ENDPROC


	PROCEDURE command1.Click
		thisform.Release()
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
"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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform