資源描述:
《畫帶陰影效果文字》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
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{//////必需的設(shè)計器變量。///privateSystem.ComponentModel.Containercomponents=null;privatestringTextToDraw="【孟憲會之精彩世界】";publicForm1(){////Windows窗體設(shè)計器支持所必需的//InitializeComponent();//在InitializeComponent調(diào)用后添加任何構(gòu)造函數(shù)代碼this.S
3、etStyle(ControlStyles.ResizeRedraw,true);}//////清理所有正在使用的資源。///protectedoverridevoidDispose(booldisposing){if(disposing){if(components!=null){components.Dispose();}}base.Dispose(disposing);}#regionWindowsFormDesignergeneratedcode////
4、//設(shè)計器支持所需的方法-不要使用代碼編輯器修改///此方法的內(nèi)容。///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//////應(yīng)用程序入口點///[
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){//創(chuàng)建一個小的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(