当前位置:首页 > 网络编程 > WEB编程 > ASP.net >  画带阴影效果的文字

 画带阴影效果的文字

点击次数:33 次 发布日期:2008-11-26 11:52:54 作者:源代码网
源代码网推荐      using System;
源代码网推荐  using System.Drawing;
源代码网推荐  using System.Drawing.Text;
源代码网推荐  using System.Drawing.Drawing2D;
源代码网推荐  using System.Collections;
源代码网推荐  using System.ComponentModel;
源代码网推荐  using System.Windows.Forms;
源代码网推荐  using System.Data;
源代码网推荐  
源代码网推荐  namespace WindowsApplication1
源代码网推荐  {
源代码网推荐  /// <summary>
源代码网推荐  /// Form1.的摘要说明。
源代码网推荐  /// </summary>
源代码网推荐  public class Form1 : System.Windows.Forms.Form
源代码网推荐  {
源代码网推荐   /// <summary>
源代码网推荐   /// 必需的设计器变量。
源代码网推荐   /// </summary>
源代码网推荐  
源代码网推荐   private System.ComponentModel.Container components = null;
源代码网推荐   private string TextToDraw = "【孟宪会之精彩世界】";
源代码网推荐  
源代码网推荐   public Form1()
源代码网推荐   {
源代码网推荐   //
源代码网推荐   // Windows 窗体设计器支持所必需的
源代码网推荐   //
源代码网推荐  
源代码网推荐   InitializeComponent();
源代码网推荐  
源代码网推荐   // 在 InitializeComponent 调用后添加任何构造函数代码
源代码网推荐  
源代码网推荐   this.SetStyle(ControlStyles.ResizeRedraw,true);
源代码网推荐  
源代码网推荐   }
源代码网推荐  
源代码网推荐  
源代码网推荐   /// <summary>
源代码网推荐   /// 清理所有正在使用的资源。
源代码网推荐   /// </summary>
源代码网推荐  
源代码网推荐   protected override void Dispose( bool disposing )
源代码网推荐   {
源代码网推荐   if( disposing )
源代码网推荐   {
源代码网推荐   if (components != null)
源代码网推荐   {
源代码网推荐   components.Dispose();
源代码网推荐   }
源代码网推荐   }
源代码网推荐   base.Dispose( disposing );
源代码网推荐   }
源代码网推荐  
源代码网推荐  
源代码网推荐   #region Windows Form Designer generated code
源代码网推荐   /// <summary>
源代码网推荐   /// 设计器支持所需的方法 - 不要使用代码编辑器修改
源代码网推荐   /// 此方法的内容。
源代码网推荐   /// </summary>
源代码网推荐   private void InitializeComponent()
源代码网推荐   {
源代码网推荐   //
源代码网推荐   // Form1
源代码网推荐   //
源代码网推荐   this.AutoScaleBaseSize = new System.Drawing.Size(16, 36);
源代码网推荐   this.BackColor = System.Drawing.Color.White;
源代码网推荐   this.ClientSize = new System.Drawing.Size(376, 293);
源代码网推荐   this.Font = new System.Drawing.Font("Tahoma", 21.75F,
源代码网推荐   System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
源代码网推荐   this.Name = "Form1";
源代码网推荐   this.Text = "Form1";
源代码网推荐   this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
源代码网推荐  
源代码网推荐   }
源代码网推荐  
源代码网推荐   #endregion
源代码网推荐  
源代码网推荐  
源代码网推荐   /// <summary>
源代码网推荐   /// 应用程序入口点
源代码网推荐   /// </summary>
源代码网推荐  
源代码网推荐   [STAThread]
源代码网推荐   static void Main()
源代码网推荐   {
源代码网推荐   Application.Run(new Form1());
源代码网推荐   }
源代码网推荐  
源代码网推荐   protected override void OnPaintBackground(PaintEventArgs e)
源代码网推荐   {
源代码网推荐   LinearGradientBrush b = new LinearGradientBrush(this.ClientRectangle,
源代码网推荐   Color.Blue,Color.AliceBlue,90f);
源代码网推荐   e.Graphics.FillRectangle(b,this.ClientRectangle);
源代码网推荐   b.Dispose();
源代码网推荐   }
源代码网推荐  
源代码网推荐   private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
源代码网推荐   {
源代码网推荐   // 创建一个小的Bitmap
源代码网推荐   Bitmap bm = new Bitmap(this.ClientSize.Width/4,this.ClientSize.Height/4);
源代码网推荐  
源代码网推荐   //得到 Graphics 对象
源代码网推荐   Graphics g = Graphics.FromImage(bm);
源代码网推荐  
源代码网推荐   // 必须使用 antialiased rendering hint
源代码网推荐   g.TextRenderingHint = TextRenderingHint.AntiAlias;
源代码网推荐  
源代码网推荐   //this matrix zooms the text out to 1/4 size and offsets it by a little right and down
源代码网推荐  
源代码网推荐   Matrix mx = new Matrix(0.25f,0,0,0.25f,3,3);
源代码网推荐  
源代码网推荐   g.Transform = mx;
源代码网推荐  
源代码网推荐   // 画阴影
源代码网推荐  
源代码网推荐   g.DrawString(TextToDraw,Font,new SolidBrush( 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();
源代码网推荐   }
源代码网推荐  }
源代码网推荐  }
源代码网推荐  
源代码网推荐  
源代码网推荐    做人要厚道,请注明转自酷网动力(www.ASPCOOL.COM)。
源代码网推荐


源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华