usingSystem;usingSystem.Drawing;usingSystem.Drawing.Text;usingSystem.Drawing.Drawing2D;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;namespaceWindowsApplication1{//////Form1.的摘要说明。///publicclassForm1:System.Windows.Forms.Form{//////必需的设计器变量。///privateSystem.ComponentModel.Containercomponents=null;privatestringTextToDraw="【孟宪会之精彩世界】";publicForm1(){////Windows窗体设计器支持所必需的//InitializeComponent();//在InitializeComponent调用后添加任何构造函数代码this.SetStyle(ControlStyles.ResizeRedraw,true);}//////清理所有正在使用的资源。///protectedoverridevoidDispose(booldisposing){if(disposing){if(components!=null){components.Dispose();}}base.Dispose(disposing);}#regionWindowsFormDesignergeneratedcode//////设计器支持所需的方法-不要使用代码编辑器修改///此方法的内容。///privatevoidInitializeComponent(){////Form1//this.AutoScaleBaseSize=newSystem.Drawing.Size(16,36);this.BackColor=System.Drawing.Color.White;this.ClientSize=newSystem.Drawing.Size(376,293);this.Font=newSystem.Drawing.Font("Tahoma",21.75F,System.Drawing.FontStyle.Bold,System.Drawing.GraphicsUnit.Point,((System.Byte)(0)));this.Name="Form1";this.Text="Form1";this.Paint+=newSystem.Windows.Forms.PaintEventHandler(this.Form1_Paint);}#endregion//////应用程序入口点///[STAThread]staticvoidMain(){Application.Run(newForm1());}protectedoverridevoidOnPaintBackground(PaintEventArgse){LinearGradientBrushb=newLinearGradientBrush(this.ClientRectangle,Color.Blue,Color.AliceBlue,90f);e.Graphics.FillRectangle(b,this.ClientRectangle);b.Dispose();}privatevoidForm1_Paint(objectsender,System.Windows.Forms.PaintEventArgse){//创建一个小的BitmapBitmapbm=newBitmap(this.ClientSize.Width/4,this.ClientSize.Height/4);//得到Graphics对象Graphicsg=Graphics.FromImage(bm);//必须使用antialiasedrenderinghintg.TextRenderingHint=TextRenderingHint.AntiAlias;//thismatrixzoomsthetextoutto1/4sizeandoffsetsitbyalittlerightanddownMatrixmx=newMatrix(0.25f,0,0,0.25f,3,3);g.Transform=mx;//画阴影g.DrawString(TextToDraw,Font,newSolidBrush(Color.FromArgb(128,Color.Black)),10,10,StringFormat.GenericTypographic);g.Dispose();e.Graphics.InterpolationMode=InterpolationMode.HighQualityBicubic;e.Graphics.TextRenderingHint=TextRenderingHint.AntiAlias;e.Graphics.DrawImage(bm,this.ClientRectangle,0,0,bm.Width,bm.Height,GraphicsUnit.Pixel);e.Graphics.DrawString(TextToDraw,Font,Brushes.White,10,10,StringFormat.GenericTypographic);bm.Dispose();}}}