C#制作不規則窗体
来源:互联网 发布:阿里巴巴串货到淘宝卖 编辑:程序博客网 时间:2024/06/05 20:45
C#制作不規則窗体
原理:利用路徑來重繪窗体.以下示例是制作一個圓弧矩形的用戶控件.
private GraphicsPath graphicsPath;
public partial class CustomToolTip : UserControl
{
public CustomToolTip()
{
InitializeComponent();
Region = new Region(graphicsPath = CreateRoundRectangle(Width - 1, Height - 1, 6));
}
private static GraphicsPath CreateRoundRectangle(int w, int h, int r)
{
int d = r << 1;
GraphicsPath path = new GraphicsPath();
path.StartFigure();
path.AddArc(new Rectangle(0, 0, d, d), 180, 90);
path.AddLine(r, 0, w - r, 0);
path.AddArc(new Rectangle(w - d, 0, d, d), 270, 90);
path.AddLine(w + 1, r, w + 1, h - r);
path.AddArc(new Rectangle(w - d, h - d, d, d), 0, 90);
path.AddLine(w - r, h + 1, r, h + 1);
path.AddArc(new Rectangle(0, h - d, d, d), 90, 90);
path.AddLine(0, h - r, 0, r);
path.CloseFigure();
return path;
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.TranslateTransform(-1, -1);
using (Pen p = new Pen(SystemColors.WindowFrame, 2))
{
e.Graphics.DrawPath(p, graphicsPath);
}
e.Graphics.ResetTransform();
}
}
- C#制作不規則窗体
- C# 制作等待窗体
- c#登陆窗体制作
- C#制作启动窗体
- C# 窗体圆角制作
- C# 窗体制作Aero效果
- C#制作闪动的窗体
- C# winform制作不规则窗体
- C#制作鼠标可以穿透的窗体
- 使用C#制作 个性化窗体 winform 界面
- 收藏的C#制作不规则窗体
- 用Borland C# Builder制作不规则窗体
- 用C#制作飘动的窗体效果
- 用C#制作飘动的窗体效果
- 用C#制作飘动的窗体效果
- C#制作不规则窗体的简单方法
- C#闪屏窗体的制作
- 用C# Builder制作不规则窗体
- 系统修复
- 平淡生活:我有姐姐啦
- 网络流量单位bps与系统单位byte转换
- Convert.ToString() ToString()对null操作不同
- 有传言mid算法要改
- C#制作不規則窗体
- 开贴庆祝
- 3个月内就拥有3年的工作经验
- 爸妈,我爱您们
- 介绍一下如何在桌面背景里面嵌入一个shell
- cognos8.2问题积累
- 背诵新概念英语的必要
- Lesson one hundred and three The French test.
- 佛学中的108条做人道理