画带阴影效果的文字
来源:互联网 发布:网络交友新时空怎么画 编辑:程序博客网 时间:2024/04/30 02:29
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();
}
}
}
- 画带阴影效果的文字
- 画带阴影效果的文字
- 画带阴影效果的文字
- 画带阴影效果的文字
- 画带阴影效果的文字
- 画带阴影效果的文字
- 画带阴影效果的文字
- Android文字的阴影效果
- 显示带阴影文字的简单办法
- android 带文字阴影的按钮
- 给文字加上阴影效果的方法
- 文字的特殊阴影效果代码
- android TextView中文字的阴影效果
- 文字阴影效果CSS
- android文字阴影效果
- android文字阴影效果
- android文字阴影效果
- Android文字阴影效果
- 最新卡巴斯基互联网安全套装7.0(kis7)系列激活码
- [转载]VB防火墙的开发原理-VB编程
- 解决打开CHM格式文件出现“网页不能浏览”错误的方法
- Eclipse-------用Eclipse开发PHP项目
- 禁止XML文件被下载
- 画带阴影效果的文字
- ASP.NET 2.0中CSS失效的问题总结
- ASP运行在IIS 6.0 500错误解决办法(转)
- VB读取武林外传内存地址
- NeatUpload
- 用VB如读取内存地址
- 也谈String和StringBuff之间的区别
- javascript实现浮动窗口
- 使用CSS解决文章换行问题