Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
unrecognize  
#1 Posted : Sunday, February 17, 2008 9:45:17 AM(UTC)
unrecognize

Rank: Member

Groups: Member
Joined: 11/5/2007(UTC)
Posts: 10

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  
#2 Posted : Sunday, February 17, 2008 2:47:06 PM(UTC)
Alex Kon

Rank: Advanced Member

Groups: Member
Joined: 1/31/2005(UTC)
Posts: 458

Was thanked: 5 time(s) in 5 post(s)
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());
}

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.