C#中渐变色的代码实例,用于自绘菜单
2010-08-24 14:08
204 查看
Graphics g = e.Graphics;
LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle,Color.SkyBlue, Color.White, LinearGradientMode.Horizontal);
g.FillRectangle(brush, this.ClientRectangle);//画一个渐变色的块
brush.Dispose();
brush = new LinearGradientBrush(this.ClientRectangle, Color.DarkBlue, Color.White, LinearGradientMode.Horizontal);
g.DrawLine(new Pen(brush, 1), 0, 0, this.Width, 0);//渐变色线
g.DrawLine(new Pen(brush, 1), 0, this.Height-1, this.Width, this.Height-1);
brush.Dispose();
g.Dispose();
其中主要是引入LinearGradientBrush,在文件头部
using System.Drawing.Drawing2D;
【原创 /article/6193707.html 】
LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle,Color.SkyBlue, Color.White, LinearGradientMode.Horizontal);
g.FillRectangle(brush, this.ClientRectangle);//画一个渐变色的块
brush.Dispose();
brush = new LinearGradientBrush(this.ClientRectangle, Color.DarkBlue, Color.White, LinearGradientMode.Horizontal);
g.DrawLine(new Pen(brush, 1), 0, 0, this.Width, 0);//渐变色线
g.DrawLine(new Pen(brush, 1), 0, this.Height-1, this.Width, this.Height-1);
brush.Dispose();
g.Dispose();
其中主要是引入LinearGradientBrush,在文件头部
using System.Drawing.Drawing2D;
【原创 /article/6193707.html 】
相关文章推荐
- C#画半透明色实例,可用于自绘菜单等
- 用于 Excel 的代码实例 (C#)
- 用于验证码图片识别的类续(C#代码)
- [C#]一步一步开发自己的自动代码生成工具之四:简单三层代码模板实例Model层
- C# 通过 oledb 操作Excel实例代码
- 用于验证码图片识别的类续(C#代码)
- 去噪:用于验证码图片识别的类续(C#代码)
- C#操作Excel代码实例
- jquery实现动态菜单的实例代码
- C#访问同类实例的私有成员代码
- ASP.NET TreeView树型菜单操作实例(代码调试通过)
- 使用C#的正则表达式验证中文字符(实例代码)
- C#代码实现,确保windows程序只有一个实例(instance)
- C#反射在实际应用中的实例代码
- c#调用C/C++代码时出现的PInvokeStackImbalance异常实例及解决方式
- C#一个简单下载程序实例(可用于更新)
- C#实现关机重启及注销实例代码
- C#装饰者模式实例代码