Forums

Welcome Guest Search | Active Topics | Members

how to get font size of resized TextVobject Options
unrecognize
Posted: Sunday, February 17, 2008 5:45:17 PM
Rank: Member
Groups: Member

Joined: 11/6/2007
Posts: 10
Points: 15
Hi, I want to get the font size of the resized TextVobject? I was try with following code, but it still get the font size before TextVobject resize.

If TypeOf obj Is Aurigma.GraphicsMill.WinControls.TextVObject Then
Dim txtObj As Aurigma.GraphicsMill.WinControls.TextVObject = CType(obj, Aurigma.GraphicsMill.WinControls.TextVObject)
MsgBox (txtObj.Font.Size)
End If


Thanks in advance.
Alex Kon
Posted: Sunday, February 17, 2008 10:47:06 PM
Rank: Advanced Member
Groups: Administration , Member

Joined: 1/31/2005
Posts: 386
Points: 403
Hello,

TextObject resize doesn't affect on the FontSize directly. It just changes VObject transformation matrix, therefore you should calculate scale coefficient and multiply it with TextObject.Font.Size value. Here is code sample to illustrate the idea:

Code:
private static float CalcDistance(System.Drawing.PointF p0,
      System.Drawing.PointF p1)
{
      float dx = p0.X - p1.X;
      float dy = p0.Y - p1.Y;
      return (float)Math.Sqrt(dx * dx + dy * dy);
}

private static float GetVerticalScale(
      Aurigma.GraphicsMill.WinControls.IVObject obj)
{
      System.Drawing.PointF[] pnts = new System.Drawing.PointF[] {
            new System.Drawing.PointF(0, 0),
            new System.Drawing.PointF(0, 1)};

      obj.Transform.TransformPoints(pnts);
      return CalcDistance(pnts[0], pnts[1]);
}

private void TestTextFontSize()
{
      Aurigma.GraphicsMill.WinControls.TextVObject textObj =
            <... get object from somewhere... >;
      System.Windows.Forms.MessageBox.Show(
            (textObj.Font.Size * GetVerticalScale(textObj)).ToString());
}



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.