Rank: Member
Groups: Guest
Joined: 1/7/2008(UTC) Posts: 28
|
Hi, We are using multilayerviewer and create some VObject (For Image) in the design. Is that possible for us to know what is the "actual printing size" of the vObject in "Inch" (And this value should be the same when we zoom in and out of the design)? For the multilayerViewer, we do have workspace size, what about those vObject?
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 1/31/2005(UTC) Posts: 458
Was thanked: 5 time(s) in 5 post(s)
|
Hi, It depends on what "actual size" do you need. If you need just bounding rectangle of the object in points - you should use VObject.GetTransformedVObjectBounds() method. If you need linear size of the object in design - there are two possible cases. If you are applying only scale/move operations to the object - you may use VObject.GetTransformedVObjectBounds() here too. But if you are using skew/rotation - you should use more complicated way: Code:Aurigma.GraphicsMill.WinControls.IVObject obj = GetObjectFromSomewhere(...);
System.Drawing.RectangleF baseRect = obj.GetVObjectBounds();
System.Drawing.PointF[] points = new System.Drawing.PointF[] {
baseRect.Location,
new System.Drawing.PointF(baseRect.Right, baseRect.Top),
new System.Drawing.PointF(baseRect.Left, baseRect.Bottom) };
obj.Transform.TransformPoints(points);
float width = CalcDistance(points[0], points[1]);
float height = CalcDistance(points[0], points[2]);
where CalcDistance() method simply returns Euclid distance between 2 points, something like that: Code:private static float CalcDistance(System.Drawing.PointF p0, System.Drawing.PointF p1)
{
return (float)System.Math.Sqrt((p0.X - p1.X) * (p0.X - p1.X) + (p0.Y - p1.Y) * (p0.Y - p1.Y));
}
All width/heights are measured in points. To convert them into inches just divide them by 72. |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 1/7/2008(UTC) Posts: 28
|
|
|
|
|
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.