利用DOTNETBAR制作圆角窗体和圆角控件
2012-11-27 09:19
232 查看
1、
如果制作圆角窗体,窗体先继承DOTNETBAR的:public partial class Form2 : DevComponents.DotNetBar.Office2007Form
然后窗体里加上一个DONTERBAR的panel,然后设置panel为fill占满整个窗体
然后设置panel的CornerType为Rounded,然后窗体就变为圆角的了: panelEx1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
2、
如果是圆角控件就照葫芦画瓢,把panel放在控件上面,然后设置为fill,再设置panel的CornerType为Rounded就变为圆角控件了
DOTNETBAR的button控件默认就可以设置为圆角按钮的
今天弄个了一天最后弄出了圆角窗体,可是不是用DOTNETBAR,原来DOTNETBAR实现不了,以下是本人实现圆角窗体的代码
如果制作圆角窗体,窗体先继承DOTNETBAR的:public partial class Form2 : DevComponents.DotNetBar.Office2007Form
然后窗体里加上一个DONTERBAR的panel,然后设置panel为fill占满整个窗体
然后设置panel的CornerType为Rounded,然后窗体就变为圆角的了: panelEx1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
2、
如果是圆角控件就照葫芦画瓢,把panel放在控件上面,然后设置为fill,再设置panel的CornerType为Rounded就变为圆角控件了
DOTNETBAR的button控件默认就可以设置为圆角按钮的
今天弄个了一天最后弄出了圆角窗体,可是不是用DOTNETBAR,原来DOTNETBAR实现不了,以下是本人实现圆角窗体的代码
/// <summary> /// 重绘窗体为圆角 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DispenserForm_Paint(object sender, PaintEventArgs e) { Form form = ((Form)sender); List<Point> list = new List<Point>(); int width = form.Width; int height = form.Height; //左上 list.Add(new Point(0, 5)); list.Add(new Point(1, 5)); list.Add(new Point(1, 3)); list.Add(new Point(2, 3)); list.Add(new Point(2, 2)); list.Add(new Point(3, 2)); list.Add(new Point(3, 1)); list.Add(new Point(5, 1)); list.Add(new Point(5, 0)); //右上 list.Add(new Point(width - 5, 0)); list.Add(new Point(width - 5, 1)); list.Add(new Point(width - 3, 1)); list.Add(new Point(width - 3, 2)); list.Add(new Point(width - 2, 2)); list.Add(new Point(width - 2, 3)); list.Add(new Point(width - 1, 3)); list.Add(new Point(width - 1, 5)); list.Add(new Point(width - 0, 5)); //右下 list.Add(new Point(width - 0, height - 5)); list.Add(new Point(width - 1, height - 5)); list.Add(new Point(width - 1, height - 3)); list.Add(new Point(width - 2, height - 3)); list.Add(new Point(width - 2, height - 2)); list.Add(new Point(width - 3, height - 2)); list.Add(new Point(width - 3, height - 1)); list.Add(new Point(width - 5, height - 1)); list.Add(new Point(width - 5, height - 0)); //左下 list.Add(new Point(5, height - 0)); list.Add(new Point(5, height - 1)); list.Add(new Point(3, height - 1)); list.Add(new Point(3, height - 2)); list.Add(new Point(2, height - 2)); list.Add(new Point(2, height - 3)); list.Add(new Point(1, height - 3)); list.Add(new Point(1, height - 5)); list.Add(new Point(0, height - 5)); Point[] points = list.ToArray(); GraphicsPath shape = new GraphicsPath(); shape.AddPolygon(points); //将窗体的显示区域设为GraphicsPath的实例 form.Region = new System.Drawing.Region(shape); }
相关文章推荐
- DOTNETBAR制作圆角窗体和圆角控件代码实例
- C/S模式开发中如何利用WebBrowser控件制作导航窗体
- C/S模式开发中如何利用WebBrowser控件制作导航窗体
- 利用.NET绘图技术制作水晶按钮控件[转]
- C#WinForm制作异形窗体/控件
- C#WinForm制作异形窗体/控件
- C#利用Label标签控件模拟窗体标题的移动及窗体颜色不断变换效果
- C#利用tabControl控件实现多窗体嵌入及关闭
- C#利用tabcontrol控件实现多窗体嵌入及关闭
- C#利用控件拖拽技术制作拼图游戏
- C#WinForm开发窗中体制作异形窗体或控件
- 利用透明图片遮罩制作圆角焦点图
- C#利用tabControl控件实现多窗体嵌入及关闭
- 三分钟免费搞定网站在线客服 源代码(利用了PowerTalkBox控件制作而成)
- C# 开发圆角控件(窗体)
- C#WinForm制作异形窗体/控件
- C#利用tabControl控件实现多窗体嵌入及关闭
- 利用.NET绘图技术制作水晶按钮控件(转)
- 【iOS开发-57】案例改进:block动画、控件的removeFromSuperview、利用layer设置圆角矩形以及代理模式运用
- C#WinForm制作异形窗体/控件