Forums

Welcome Guest Search | Active Topics | Members

How to get coordinate of a LineVobject Options
stefano1403
Posted: Tuesday, April 29, 2008 5:44:11 AM
Rank: Newbie
Groups: Member

Joined: 3/18/2008
Posts: 8
Points: 24
(1) I add a LineVobject with this code:

//Create a line object
Aurigma.GraphicsMill.WinControls.LineVObject line = new
Aurigma.GraphicsMill.WinControls.LineVObject(X1, Y1,X2, Y2 );

//Modify stroke and fill parameters
line.Pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);
line.Brush = new System.Drawing.SolidBrush(System.Drawing.Color.Transparent);

//Add the rectangle to a layer
//vobj is VObjectsRubberband associated with the bitmapviewer
vobj.Layers[0].VObjects.Add(line);

(2) I move the object with the mouse and then i need new (x1,y1) and (x2,y2) coordinate:
-obj.GetVObjectBounds(); give me the original rectangle that contains the line
-obj.GetControlPointsBounds(); give me the new rectangle that contains the line

The question is that there is no a property such as Points (like in the PolylineVObject). How can i get the new line coordinate?

thank in advance
Alex Kon
Posted: Tuesday, April 29, 2008 7:40:03 AM
Rank: Advanced Member
Groups: Administration , Member

Joined: 1/31/2005
Posts: 380
Points: 385
Hi

No, unfortunately there is no public propery for this. However, as you know matrix from VObject.Transform property, so you can always apply it to the inital points and get current coordinates.

So, I think that the best way is to inherit new class from the existing LineVObject and implement such properties as Point1 and Point2 via matrix transformations.


Best wishes, Alex.
stefano1403
Posted: Tuesday, April 29, 2008 9:28:31 AM
Rank: Newbie
Groups: Member

Joined: 3/18/2008
Posts: 8
Points: 24
thank for your answer; what you suggest is useful also if the user move the object with mouse for a while?
Alex Kon
Posted: Tuesday, April 29, 2008 10:24:35 PM
Rank: Advanced Member
Groups: Administration , Member

Joined: 1/31/2005
Posts: 380
Points: 385
Hello,

Yes, of course. VObject.Transform stores all transformations which were made with the object.


Best wishes, Alex.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Yet Another Forum.net version 1.9.1.6 running under Cuyahoga.
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.