Class Utils
Utils contains static method to perform utility functions
Inheritance
Namespace: Syncfusion.Windows.Edit
Assembly: Syncfusion.Edit.Wpf.dll
Syntax
public static class Utils : Object
Remarks
The Util class used to bound the objects and also it has format methods like GetWidth, GetFormattedText.
Methods
GetFormattedText(String, FontFamily, Double, Brush, Double, Int32)
GetFormattedText methods is used to get the formatted text based on the text, fontfamily, fontsize, foreground parameters.
Declaration
public static FormattedText GetFormattedText(string text, FontFamily fontFamily, double fontSize, Brush foreground, double pixelperDip, int tabspaces = 4)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to be format. |
| System.Windows.Media.FontFamily | fontFamily | Fontfamily of the text. |
| System.Double | fontSize | Fontsize of the text. |
| System.Windows.Media.Brush | foreground | Foreground of the text. |
| System.Double | pixelperDip | , PixelPerDip of the text. |
| System.Int32 | tabspaces | Number of spaces to replace each tab with. |
Returns
| Type |
|---|
| System.Windows.Media.FormattedText |
Remarks
This method used to get the formatted text with the specified fontfamily, fontsize and foreground.
GetFormattedTextDecoration(String, FontFamily, Double, Brush, ISnippetFormat, Double)
GetFormattedTextDecoration method used to get the formatted text and text decoration based on the text, fontfamily, fontsize, foreground,format parameters.
Declaration
public static FormattedText GetFormattedTextDecoration(string text, FontFamily fontFamily, double fontSize, Brush foreground, ISnippetFormat format, double pixelperDip)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | |
| System.Windows.Media.FontFamily | fontFamily | |
| System.Double | fontSize | |
| System.Windows.Media.Brush | foreground | |
| ISnippetFormat | format | |
| System.Double | pixelperDip | , PixelPerDip of the text. |
Returns
| Type |
|---|
| System.Windows.Media.FormattedText |
GetHeight(String, FontFamily, Double, Brush, Double, Int32)
GetHeight method used to calculate the text height based on the text, fontfamily, fontsize and foreground
Declaration
public static double GetHeight(string text, FontFamily fontFamily, double fontSize, Brush foreground, double pixelperDip, int tabspaces = 4)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to format. |
| System.Windows.Media.FontFamily | fontFamily | Fontfamily of the text. |
| System.Double | fontSize | Fontsize of the text. |
| System.Windows.Media.Brush | foreground | Foreground of the text. |
| System.Double | pixelperDip | , PixelPerDip of the text. |
| System.Int32 | tabspaces | Number of spaces to replace each tab with. |
Returns
| Type | Description |
|---|---|
| System.Double | Returns the formatted text width. |
Remarks
This method used to calculate the width of the text.
GetWidth(String, FontFamily, Double, Brush, Double, Int32)
Calculates the width of the text for the given font and brush.
Declaration
public static double GetWidth(string text, FontFamily fontFamily, double fontSize, Brush foreground, double pixelperDip, int tabspaces = 4)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to measure. |
| System.Windows.Media.FontFamily | fontFamily | The font family. |
| System.Double | fontSize | The font size. |
| System.Windows.Media.Brush | foreground | The brush used to render the text. |
| System.Double | pixelperDip | The pixels-per-DIP scaling factor. |
| System.Int32 | tabspaces | Number of spaces to replace each tab with. |
Returns
| Type | Description |
|---|---|
| System.Double | Returns the formatted text width. |