资源描述:
《画带阴影效果文字》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、usingSystem;usingSystem.Drawing;usingSystem.Drawing.Text;usingSystem.Drawing.Drawing2D;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;namespaceWindowsApplication1{//////Form1.的摘要说明。///publicclass
2、Form1:System.Windows.Forms.Form{//////必需的设计器变量。///privateSystem.ComponentModel.Containercomponents=null;privatestringTextToDraw="【孟宪会之精彩世界】";publicForm1(){////Windows窗体设计器支持所必需的//InitializeComponent();//在InitializeComponent调用后添加任何构造函数代码this.S
3、etStyle(ControlStyles.ResizeRedraw,true);}//////清理所有正在使用的资源。///protectedoverridevoidDispose(booldisposing){if(disposing){if(components!=null){components.Dispose();}}base.Dispose(disposing);}#regionWindowsFormDesignergeneratedcode////
4、//设计器支持所需的方法-不要使用代码编辑器修改///此方法的内容。///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
5、.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//////应用程序入口点///[
6、STAThread]staticvoidMain(){Application.Run(newForm1());}protectedoverridevoidOnPaintBackground(PaintEventArgse){LinearGradientBrushb=newLinearGradientBrush(this.ClientRectangle,Color.Blue,Color.AliceBlue,90f);e.Graphics.FillRectangle(b,this.ClientRectangle);b.D
7、ispose();}privatevoidForm1_Paint(objectsender,System.Windows.Forms.PaintEventArgse){//创建一个小的BitmapBitmapbm=newBitmap(this.ClientSize.Width/4,this.ClientSize.Height/4);//得到Graphics对象Graphicsg=Graphics.FromImage(bm);//必须使用antialiasedrenderinghintg.TextRenderingHi
8、nt=TextRenderingHint.AntiAlias;//thismatrixzoomsthetextoutto1/4sizeandoffsetsitbyalittlerightanddownMatrixmx=newMatrix(0.25f,0,0,0.25f,3,3);g.Transform=mx;//画阴影g.DrawString(