Graphics g = e.Graphics;

            // 圆角半径
int cRadius = ; // 要实现 圆角化的 矩形
Rectangle rect = new Rectangle(, , panel4.Width - cRadius, panel4.Height - cRadius); // 指定图形路径, 有一系列 直线/曲线 组成
GraphicsPath myPath = new GraphicsPath();
myPath.StartFigure();
myPath.AddArc(new Rectangle(new Point(rect.X, rect.Y), new Size( * cRadius, * cRadius)), , );
myPath.AddLine(new Point(rect.X + cRadius, rect.Y), new Point(rect.Right - cRadius, rect.Y));
myPath.AddArc(new Rectangle(new Point(rect.Right - * cRadius, rect.Y), new Size( * cRadius, * cRadius)), , );
myPath.AddLine(new Point(rect.Right, rect.Y + cRadius), new Point(rect.Right, rect.Bottom - cRadius));
myPath.AddArc(new Rectangle(new Point(rect.Right - * cRadius, rect.Bottom - * cRadius), new Size( * cRadius, * cRadius)), , );
myPath.AddLine(new Point(rect.Right - cRadius, rect.Bottom), new Point(rect.X + cRadius, rect.Bottom));
myPath.AddArc(new Rectangle(new Point(rect.X, rect.Bottom - * cRadius), new Size( * cRadius, * cRadius)), , );
myPath.AddLine(new Point(rect.X, rect.Bottom - cRadius), new Point(rect.X, rect.Y + cRadius));
myPath.CloseFigure();
g.DrawPath(new Pen(Color.Red, ), myPath);

C# 绘制圆角矩形的更多相关文章

  1. 在Microsoft Expression Blend 2 中绘制圆角矩形按钮

    原文:在Microsoft Expression Blend 2 中绘制圆角矩形按钮 /* 声明:转载请保留此信息:http://www.BrawDraw.com, http://www.ZPXP.c ...

  2. canva绘制圆角矩形

    在做组态的时候,需要支持矩形圆角格式,但是因为canvas本身不带有圆角矩形,需要自行算出坐标进行绘制 方案一.统一圆角 <!DOCTYPE html> <html> < ...

  3. Android中绘制圆角矩形图片及任意形状图片

    圆角矩形图片在苹果的产品中很流行,相比于普通的矩形,很多人都喜欢圆角矩形的图片,因为它避开了直角的生硬,带来更好的用户体验,下面是几个设计的例子: 下面在Android中实现将普通的矩形图片绘制成圆角 ...

  4. Delphi中绘制圆角矩形的窗体

    制作圆角矩形的窗体: 01.procedure TPortForm.FormCreate(Sender: Tobject); 02.var hr :thandle; 03.begin 04.hr:=c ...

  5. Cocos2d-x绘制圆角矩形

    /* * @brief 画圆角矩形 * @param origin 矩形开始点 * @param destination 矩形结束点 * @param radius 圆角半径 * @param seg ...

  6. canvas 绘制圆角矩形

    <!DOCTYPE HTML> <head> <meta charset = "utf-8"> <title>canvas</ ...

  7. 使用Draw rect 绘制圆角矩形

    - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); UIGraphicsPush ...

  8. 详解使用CSS3绘制矩形、圆角矩形、圆形、椭圆形、三角形、弧

    1.矩形 绘制矩形应该是最简单的了,直接设置div的宽和高,填充颜色,效果就出来了. 2.圆角矩形 绘制圆角矩形也很简单,在1的基础上,在使用css3的border-radius,即可. 3.圆 根据 ...

  9. Android开发之自定义圆角矩形图片ImageView的实现

    android中的ImageView只能显示矩形的图片,这样一来不能满足我们其他的需求,比如要显示圆角矩形的图片,这个时候,我们就需要自定义ImageView了,其原理就是首先获取到图片的Bitmap ...

随机推荐

  1. chrome 调试进入 paused in debugger 状态解决办法

    今天调试代码的时候总是一刷新就进入 debugger 状态,总是需要按几次 F8 才能进到页面,我那个暴脾气啊,几次后终于是忍不住了,然后再网上找到了解决办法.就如一位网友所说,“Oh God! I ...

  2. org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password:

    tationProcessor' to allow for resolving potential circular referencesDEBUG 2018-05-28 11:32:35,016 o ...

  3. c++试题2

    一.写出下列程序的运行结果(40 分) 1.for(i=1;i<5;i++); cout << “OK” << endl; 程序执行后的输出结果是:  OK    ___ ...

  4. HDU 2612 - Find a way - [BFS]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 Problem DescriptionPass a year learning in Hangz ...

  5. findStr

    目录 规则 目录结构 src/main.cpp src/findstr.cpp include/findstr.h ft/TestCase.cpp ft/makefile ftbuild.sh mai ...

  6. Mac破解免费office软件

    一.下载安装包及破解工具 地址: https://pan.baidu.com/s/1hugtoLQ 密码: s5in 附官网地址 文件夹中包含三个文件: Office16安装文件 Microsoft_ ...

  7. Linux命令:在线练习地址

    1.https://www.tutorialspoint.com/unix_terminal_online.php 2.https://www.tutorialspoint.com/index.htm ...

  8. [CSS] Frequently used method or solutions for issues

    Stick button in right side in html Solution: //In the html <div class="float__button" & ...

  9. appium环境搭建-运行

    appium是测试移动端的测试工具 首先要下载手机模拟器,或者连接真机.我用的夜神模拟器.安装打开它.安装这个有很高的兼容性要求,我也是小白,摸索了三天才弄出来 一.原理如图: 二.需要安装的软件: ...

  10. SQL Server 百万级数据提高查询速度的方法(转)

    1.应尽量避免在 where 子句中使用!=或<>操作符,否则将引擎放弃使用索引而进行全表扫描.2.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及 ...