←Select platform

GetTextSize Method

Summary
Returns the size of a text with an AnnFont and clipping size.
Syntax
C#
C++/CLI
public static LeadSizeD GetTextSize( 
   string text, 
   AnnFont font, 
   LeadSizeD layoutArea 
) 
public:  
   static LeadSizeD^ GetTextSize( 
      String^ text, 
      AnnFont^ font, 
      LeadSizeD^ layoutArea 
   ) 

Parameters

text
The source text string

font
The font to use

layoutArea
Clipping size to use.

Return Value

The size of the text.

Example
C#
using Leadtools.Annotations.Automation; 
using Leadtools.Annotations.Engine; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Codecs; 
using Leadtools.Annotations.WinForms; 
 
public void AnnRenderingEngine_GetTextSize() 
{ 
   double inch = 720.0; 
 
   // Get the container 
   AnnContainer container = _automation.Container; 
 
   // Create a new AnnTextObject 
   AnnTextObject txtObject = new AnnTextObject(); 
   txtObject.Rect = LeadRectD.Create(3 * inch, 3 * inch, 1 * inch, 1 * inch); 
   txtObject.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(1)); 
   txtObject.Text = "LEADTOOLS"; 
 
   container.Children.Add(txtObject); 
   // Measure the size of a text string 
   LeadSizeD size = AnnWinFormsRenderingEngine.GetTextSize(txtObject.Text, txtObject.Font, txtObject.Bounds.Size); 
   Debug.WriteLine(size.ToString()); 
} 
Requirements

Target Platforms

Help Version 22.0.2022.12.13
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Rendering.WinForms Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.