←Select platform

GetTextSize Method (AnnWinFormsRenderingEngine)

Summary

Returns the size of a text with a AnnFont and clipping size.

Syntax

C#
VB
Public Shared Function GetTextSize( _ 
   ByVal text As String, _ 
   ByVal font As Leadtools.Annotations.Core.AnnFont, _ 
   ByVal layoutArea As Leadtools.LeadSizeD _ 
) As Leadtools.LeadSizeD 

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.Core; 
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

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Annotations.Rendering Assembly
Click or drag to resize