Version

StyleInfo Class

Contains style related information.
Syntax
'Declaration
 
Public Class StyleInfo 
public class StyleInfo 
Example
The following code demonstrates usage for ApplyStyle, GetCurrentStyle and related methods.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Misc
Imports Infragistics.Win.FormattedLinkLabel

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        Me.ultraFormattedTextEditor1.Value = "Test"

        Dim editInfo As FormattedTextEditInfo = Me.ultraFormattedTextEditor1.EditInfo

        ' Select some content.
        editInfo.SelectionStart = 0
        editInfo.SelectionLength = 2

        ' Apply some style to the selected content.
        editInfo.ApplyStyle("color: blue; background-color: yellow; font-size: +6pt;", False)

        ' Get the current style. This method returns style attributes that are common
        ' among all the selected contents. This method can be used to update the
        ' toolbar button states for example.
        Dim style As StyleInfo = editInfo.GetCurrentStyle()

        ' Print out the font size. It should be +6pt since that's what we set above.
        Debug.WriteLine("Font size: " & style.FontSize.ToString())
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim editInfo As FormattedTextEditInfo = Me.ultraFormattedTextEditor1.EditInfo

        ' Select something. ClearStyleAttributes and ClearAllStyleAttributes perform
        ' their operations on the selected content.
        editInfo.SelectAll()

        ' ClearStyleAttributes can be used to clear specific style attributes. Here
        ' we are clearing the font-size and background-color settings of the selected
        ' conents.
        editInfo.ClearStyleAttributes(New String() {"font-size", "background-color"})

        ' You can also clear all the style attributes using the ClearAllStyleAttributes
        ' method.
        editInfo.ClearAllStyleAttributes()
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Misc;
using Infragistics.Win.FormattedLinkLabel;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			this.ultraFormattedTextEditor1.Value = "Test";

			FormattedTextEditInfo editInfo = this.ultraFormattedTextEditor1.EditInfo;

			// Select some content.
			editInfo.SelectionStart = 0;
			editInfo.SelectionLength = 2;

			// Apply some style to the selected content.
			editInfo.ApplyStyle( "color: blue; background-color: yellow; font-size: +6pt;", false );

			// Get the current style. This method returns style attributes that are common
			// among all the selected contents. This method can be used to update the
			// toolbar button states for example.
			StyleInfo style = editInfo.GetCurrentStyle( );

			// Print out the font size. It should be +6pt since that's what we set above.
			Debug.WriteLine( "Font size: " + style.FontSize.ToString( ) );
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			FormattedTextEditInfo editInfo = this.ultraFormattedTextEditor1.EditInfo;

			// Select something. ClearStyleAttributes and ClearAllStyleAttributes perform
			// their operations on the selected content.
			editInfo.SelectAll( );
			
			// ClearStyleAttributes can be used to clear specific style attributes. Here
			// we are clearing the font-size and background-color settings of the selected
			// conents.
			editInfo.ClearStyleAttributes( new string[] { "font-size", "background-color" } );

			// You can also clear all the style attributes using the ClearAllStyleAttributes
			// method.
			editInfo.ClearAllStyleAttributes( );
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also