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

首頁 > 編程 > C# > 正文

解析C#中如何把控件的邊框角畫為圓弧

2020-01-24 03:12:15
字體:
來源:轉載
供稿:網(wǎng)友

復制代碼 代碼如下:

private void Draw(Graphics graphics, Control control)
        {
            float X = float.Parse(control.Width.ToString()) - 1;
            float Y = float.Parse(control.Height.ToString()) - 1;
            PointF[] pointfs = {
                new PointF(2,     0),
                new PointF(X-2,   0),
                new PointF(X-1,   1),
                new PointF(X,     2),
                new PointF(X,     Y-2),
                new PointF(X-1,   Y-1),
                new PointF(X-2,   Y),
                new PointF(2,     Y),
                new PointF(1,     Y-1),
                new PointF(0,     Y-2),
                new PointF(0,     2),
                new PointF(1,     1)
                };

            GraphicsPath path = new GraphicsPath();
            path.AddLines(pointfs);

            Pen pen = new Pen(Color.FromArgb(150, Color.Blue), 1);
            pen.DashStyle = DashStyle.Solid;
            graphics.DrawPath(pen, path);
        }


首先要把控件注冊一個事件:控件名稱.Paint+=事件名稱,然后把以上函數(shù)進行傳參,如:Draw(e.Graphics, this.control);

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 万宁市| 肥城市| 搜索| 衡阳市| 江西省| 溆浦县| 左云县| 湟源县| 伊通| 汾西县| 郧西县| 宝丰县| 汝南县| 扬中市| 扎赉特旗| 抚州市| 南陵县| 佛坪县| 黄梅县| 崇仁县| 曲沃县| 陆川县| 牙克石市| 雷波县| 泾阳县| 汶上县| 枣阳市| 天全县| 玉树县| 临泽县| 昌平区| 城市| 永德县| 平乐县| 濮阳县| 陇川县| 甘泉县| 凤城市| 延津县| 五莲县| 龙江县|