User Interface for .NET / User's Guide / RichText Labels / XML-formatted Style

XML-formatted Style
 Overview
Enter the next-generation presentation layer by experiencing our NRichTextLabel component. Ever been impressed from the way you may format texts in HTML and *.rtf files? Our label will allow you to do this in exactly the same way and will definitely give your applications 'out-of-the-box' appearance. The control is a combination of NShadowDecorator, NUIItem and NTextDocument instances which allow you to modify both the filling, border and shadow information and text, image, alignments, etc.
 Providing Formatted Text

The control's NTextDocument may be created internally for you from a correctly XML-formatted text. "Correctly" means that you supply only the supported tags and always close the opening tag. 

 

The following code demonstrates how to create and initialize a NRichTextLabel instance:

C#
Copy Code
this.nRichTextLabel1.FillInfo.Gradient1 = Color.FromArgb(90, 125, 222);
this.nRichTextLabel1.FillInfo.Gradient2 = Color.FromArgb(155, 186, 247); 
this.nRichTextLabel1.FillInfo.GradientAngle = 15F;
this.nRichTextLabel1.FillInfo.GradientStyle = GradientStyle.SigmaBell;
this.nRichTextLabel1.Item.ContentAlign = ContentAlignment.MiddleCenter;
this.nRichTextLabel1.Item.Image = myImage; 
this.nRichTextLabel1.Item.ImageSize = new Size(28, 28);
this.nRichTextLabel1.Item.Padding.All = 5;
this.nRichTextLabel1.Item.Size = new Size(288, 64);
this.nRichTextLabel1.Location = new Point(8, 8);
this.nRichTextLabel1.Name = "nRichTextLabel1";
this.nRichTextLabel1.Size = new Size(296, 72);
this.nRichTextLabel1.StrokeInfo.Color = Color.FromArgb(0, 45, 150);
this.nRichTextLabel1.StrokeInfo.PenWidth = 2;
this.nRichTextLabel1.StrokeInfo.Rounding = 10;
this.nRichTextLabel1.TabIndex = 0;
this.nRichTextLabel1.Text = 
"<font face=\'Tahoma\' color=\'white\'>The Nevron <b><u><font color=\'whitesmoke\'>NRich" +
"TextLabel</font></u></b> is a <i><b>revolutionary</b></i> component which allows" +
" you to display <font color=\'red\'><b>HTML</b></font> formatted texts with ease.<" +
"/font>";
Visual Basic
Copy Code
Me.nRichTextLabel1.FillInfo.Gradient1 = Color.FromArgb(90, 125, 222)
Me.nRichTextLabel1.FillInfo.Gradient2 = Color.FromArgb(155, 186, 247) 
Me.nRichTextLabel1.FillInfo.GradientAngle = 15F
Me.nRichTextLabel1.FillInfo.GradientStyle = GradientStyle.SigmaBell
Me.nRichTextLabel1.Item.ContentAlign = ContentAlignment.MiddleCenter
Me.nRichTextLabel1.Item.Image = myImage
Me.nRichTextLabel1.Item.ImageSize = New Size(28, 28)
Me.nRichTextLabel1.Item.Padding.All = 5
Me.nRichTextLabel1.Item.Size = New Size(288, 64)
Me.nRichTextLabel1.Location = New Point(8, 8)
Me.nRichTextLabel1.Name = "nRichTextLabel1"
Me.nRichTextLabel1.Size = New Size(296, 72)
Me.nRichTextLabel1.StrokeInfo.Color = Color.FromArgb(0, 45, 150)
Me.nRichTextLabel1.StrokeInfo.PenWidth = 2
Me.nRichTextLabel1.StrokeInfo.Rounding = 10
Me.nRichTextLabel1.TabIndex = 0
Me.nRichTextLabel1.Text = 
"<font face=\'Tahoma\' color=\'white\'>The Nevron <b><u><font color=\'whitesmoke\'>NRich" +
"TextLabel</font></u></b> is a <i><b>revolutionary</b></i> component which allows" +
" you to display <font color=\'red\'><b>HTML</b></font> formatted texts with ease.<" +
"/font>"

Following is the result of the above code:

See Also