FontName Property
- Namespace
TXTextControl
- Package
TXTextControl.asTextControl. WinForms. SDK TXTextControl.from the private NuGet feed or Text Control Offline Packagesdll
Description
Gets or sets the font of the selected text.
Syntax
public string FontName { get; set; }Public Property FontName As StringExamples
The following example formats the heading of a short document by using Selection.FontName.
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;
selection.FontName = "Arial";
if (!string.IsNullOrWhiteSpace(selection.FontName))
{
Console.WriteLine($"Font Name: {selection.FontName}");
}textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection
selection.FontName = "Arial"
If Not String.IsNullOrWhiteSpace(selection.FontName) Then
Console.WriteLine($"Font Name: {selection.FontName}")
End IfLimitations
Runtime only.
Remarks
The property returns an empty string when the text selection contains multiple characters with mixed font names. The Selection.IsCommonValueSelected method can be used to check for mixed attributes.