Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, September 10, 2009 5:55:24 AM(UTC)

risken  
risken

Groups: Registered
Posts: 6


I got a problem that when i pass the "fontString" to create AnnFont Object. Is it LT must need to use AnnLenght to set the fontsize value?

FontDialog fd = new FontDialog();

if(fd.ShowDialog() != DialogResult.Cancel )
{
Font font = fd.Font;
TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font));
string fontString = tc.ConvertToString(font);
Font newFont = (Font)tc.ConvertFromString(fontString);
}
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, September 11, 2009 6:15:36 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


You shouldn't have to do any conversions like you are attempting.  Just use the properties of the System.Drawing.Font object to create the Leadtools.Annotations.AnnFont object.

Check out MSDN for documentation on the different properties of the System.Drawing.Font class: http://msdn.microsoft.co...rawing.font_members.aspx

For the most part, the only properties you'll need are the Family, Style, and the size.  For example:

System.Drawing.Font font
// get Font from dialog
Leadtools.Annotation.AnnFont annFont = new AnnFont(font.FontFamily, new AnnLength(font.SizeInPoints, AnnUnit.Point), font.Style)
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.046 seconds.