The Code is as follows:
Using System;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Drawing;
Using System. Drawing. Text;
Using System. Drawing. Drawing2D;
Using System. Data;
Using System. Text;
Using System. Windows. Forms;
Public partial class WordArt: UserControl // This Is A WordArt Control
{
// Text attributes
Private string _ text = "WordArt ";
Public string Caption
{
Get {return _ text ;}
Set {_ text = value ;}
}
// Font and size
Private Font _ WordArtFont = new Font ("", 15 );
Public Font WordArtFont
{
Get {return _ WordArtFont ;}
Set {_ WordArtFont = value ;}
}
// Color
Private Color _ WordArtForeColor = Color. bluevilet;
Public Color WordArtForeColor
{
Get {return _ WordArtForeColor ;}
Set {_ WordArtForeColor = value ;}
}
// Shadow color
Private Color _ WordArtBackColor = Color. Gray;
Public Color WordArtBackColor
{
Set {_ WordArtBackColor = value ;}
Get {return _ WordArtBackColor ;}
}
// Text output quality: rendering mode and smooth Effect
Private TextRenderingHint _ TextRenderingHint = TextRenderingHint. ClearTypeGridFit;
Public TextRenderingHint WordArtTextRenderingHint
{
Get {return _ TextRenderingHint ;}
Set {_ TextRenderingHint = value ;}
}
Public SmoothingMode _ SmoothingMode = SmoothingMode. AntiAlias;
Public SmoothingMode WordArtSmoothingMode
{
Get {return _ SmoothingMode ;}
Set {_ SmoothingMode = value ;}
}
Public WordArt ()
{
InitializeComponent ();
}
// Form of artistic words: Shadow, embossed ......
Private WordArtEffectStyle _ WordArtEffect = WordArtEffectStyle. projection; // The default projection format is used;
Public WordArtEffectStyle WordArtEffect
{
Get {return _ WordArtEffect ;}
Set {_ WordArtEffect = value ;}
}
Protected override void OnPaint (PaintEventArgs e)
{
Base. OnPaint (e );
Graphics g = this. CreateGraphics ();
Brush backBrush = new SolidBrush (this. WordArtBackColor );
Brush foreBrush = new SolidBrush (this. WordArtForeColor );
SizeF size = g. MeasureString (this. Caption, this. WordArtFont );
Single posX = (this. Width-Convert. ToInt16 (size. Width)/2;
Single posY = (this. Height-Convert. ToInt16 (size. Height)/2;
Switch (this. WordArtEffect)
{
Case WordArtEffectStyle. projection: // projection Effect
// Set the text output quality
G. TextRenderingHint = this. WordArtTextRenderingHint;
G. SmoothingMode = this. WordArtSmoothingMode;
Matrix matrix = new Matrix ();
// Projection
Matrix. Shear (-1.5f, 0.0f );
// Zoom
Matrix. Scale (1, 0.5f );
// Translation
Matrix. Translate (120, 75 );
// Transform the plane coordinate of the Drawing
G. Transform = matrix;