PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 3:32 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Jul 23, 2014 1:48 pm 
Offline

Joined: Wed Jul 23, 2014 1:41 pm
Posts: 2
I am trying to detect the size that a string will take when printed on the page with a certain font :

_Font = new XFont("Verdana", 20, XFontStyle.Bold);

_GFX.DrawString(title, _Font, XBrushes.Black, new XRect(160, 10, 442, 100), XStringFormats.Center);

Is there a way to do that? I want to detect how much place title will take in the XRect to fit in it


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 24, 2014 9:53 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 340
Try gfx.MeasureString().

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 25, 2014 6:09 pm 
Offline

Joined: Wed Jul 23, 2014 1:41 pm
Posts: 2
@() => true, thank you, I can get the size in px with gfx.MeasureString(), exactly what I wanted


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 352 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group