国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

DOTNETBAR制作圓角窗體和圓角控件代碼實例

2020-01-24 03:03:53
字體:
來源:轉載
供稿:網友

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實現不了,以下是本人實現圓角窗體的代碼

 

復制代碼 代碼如下:

 /// <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);
        }
 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 勐海县| 兴国县| 黄大仙区| 偃师市| 合水县| 上林县| 望江县| 山阴县| 阿拉善右旗| 横峰县| 延寿县| 桦甸市| 秀山| 长武县| 澎湖县| 班戈县| 清新县| 巴林左旗| 天长市| 德钦县| 登封市| 普格县| 视频| 平谷区| 淮滨县| 大渡口区| 闸北区| 郸城县| 靖江市| 灵寿县| 建平县| 洞口县| 洪泽县| 铁岭市| 拉萨市| 潍坊市| 丹江口市| 宁波市| 南丰县| 岫岩| 进贤县|