private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;//去掉锯齿
g.CompositingQuality = CompositingQuality.HighQuality;//合成图像的质量
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;//去掉文字的锯齿
System.Drawing.Pen p = new System.Drawing.Pen(Color.FromArgb(255, 146, 126, 102), 2); drawRoundedRect(g, p, 20, 20, 200, 200, 20);
} /// <summary>
/// 带圆角矩形
/// </summary>
/// <param name="radius">圆角半径</param>
private void drawRoundedRect(Graphics g, System.Drawing.Pen pen, int x, int y, int width, int height, int radius)
{
//去掉圆角的锯齿
g.SmoothingMode = SmoothingMode.HighQuality; //上
g.DrawLine(pen, new PointF(x + radius, y), new PointF(x + width - radius, y));
//下
g.DrawLine(pen, new PointF(x + radius, y + height), new PointF(x + width - radius, y + height));
//左
g.DrawLine(pen, new PointF(x, y + radius), new PointF(x, y + height - radius));
//右
g.DrawLine(pen, new PointF(x + width, y + radius), new PointF(x + width, y + height - radius)); //左上角
g.DrawArc(pen, new Rectangle(x, y, radius * 2, radius * 2), 180, 90);
//右上角
g.DrawArc(pen, new Rectangle(x + width - radius * 2, y, radius * 2, radius * 2), 270, 90);
//左下角
g.DrawArc(pen, new Rectangle(x, y + height - radius * 2, radius * 2, radius * 2), 90, 90);
//右下角
g.DrawArc(pen, new Rectangle(x + width - radius * 2, y + height - radius * 2, radius * 2, radius * 2), 0, 90);
}

  

winform GDI基础(二)画带圆角的矩形框的更多相关文章

  1. winform GDI基础(一)

    1获取画布 (1)从PaintEventArgs类中获取画布 private void Form1_Paint(object sender, PaintEventArgs e) { Graphics ...

  2. Winform GDI+绘图二:绘制旋转太极图

    大家好,今天有时间给大家带来Winform自绘控件的第二部分,也是比较有意思的一个控件:旋转太极图. 大家可以停下思考一下,如果让你来绘制旋转的太极图,大家有什么样的思路呢?我今天跟大家展示一下,我平 ...

  3. winform GDI基础(四)简单截屏

    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); G ...

  4. winform GDI基础(三)实现画笔

    在程序窗口上使用鼠标画图 private Point pStart, pEnd; private bool isAllowDraw = false; private bool isOpenPen = ...

  5. Win32 GDI基础(笔记)

    1.GDI名字的意义 GDI Graphic Device Interface,我说不清和GUI有什么区别.可能一种针对设备,一种针对用户而言吧,反正以后都说GDI,也就是Windows的图形编程. ...

  6. 《C# GDI+ 破境之道》:第一境 GDI+基础 —— 第三节:画圆形

    有了上一节画矩形的基础,画圆形就不要太轻松+EZ:)所以,本节在画边线及填充上,就不做过多的讲解了,关注一下画“随机椭圆”.“正圆”.“路径填充”的具体实现就好.与画矩形相比较,画椭圆与之完全一致,没 ...

  7. WinForm GDI+ 资料收集

    UI(User Interface)编程在整个项目开发过程中是个颇为重要的环节,任何好的解决方案若没有良好的用户界面呈现给最终用户,那么就算包含了最先进的技术也不能算是好程序.UI编程体现在两个方面, ...

  8. CSS 奇思妙想 | 巧妙的实现带圆角的三角形

    之前在这篇文章中 -- <老生常谈之 CSS 实现三角形>,介绍了 6 种使用 CSS 实现三角形的方式. 但是其中漏掉了一个非常重要的场景,如何使用纯 CSS 实现带圆角的三角形呢?,像 ...

  9. Bootstrap <基础二十二>超大屏幕(Jumbotron)

    Bootstrap 支持的另一个特性,超大屏幕(Jumbotron).顾名思义该组件可以增加标题的大小,并为登陆页面内容添加更多的外边距(margin).使用超大屏幕(Jumbotron)的步骤如下: ...

随机推荐

  1. Mxgraph使用总结二

    1 新建画板,画板相关操作 var container = document.getElementById("main"); //设置背景样式 container.style.ba ...

  2. C# 获取计算机的硬件信息

    /// <summary> /// 获得CPU编号 /// </summary> /// <returns></returns> public stri ...

  3. 单端IO标准

    单端标准 常用的单端IO标准是LVTTL和LVCMOS. 目前业界绝大部分FPGA/CPLD器件的LVCOMS的IO是由CMOS推挽(push-pull)驱动器构成的,这种结构是上面的PMOS管和下面 ...

  4. POJ3321(dfs序列+树状数组)

    Apple Tree Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 25711   Accepted: 7624 Descr ...

  5. Java-API:java.util.Random

    ylbtech-Java-API:java.util.Random 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部 1. https://docs.oracle. ...

  6. cpu上下文切换(下)

    --怎么查看系统的上下文切换情况 过多的上下文切换,会把cpu时间消耗在寄存器.内核栈以及虚拟内存等数据的保存和恢复上,缩短进程真正运行的时间,成了系统性能大幅下降的一个元凶. 查看,使用vmstat ...

  7. windows下socket编程:区分shutdown()及closesocket()

    以下描述主要是针对windows平台下的TCP socket而言. 首先需要区分一下关闭socket和关闭TCP连接的区别,关闭TCP连接是指TCP协议层的东西,就是两个TCP端之间交换了一些协议包( ...

  8. springmvc----demo1---hello---bai

    import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import ...

  9. [phonegap]安装升级

    安装 npm install -g phonegapnpm install -g phonegap@版本号    比如 npm install -g phonegap@3.3.0-0.19.6 升级 ...

  10. Java 的标识符

    标识符: 在写代码的时候为了增强代码的阅读性会自定义很多名字,如:类名.方法名.变量名等 这种名称成为标识符 标识符命名规则: 由字母(可以是中文).数字.下划线.$ 组成,但不能以数字开头 大小写敏 ...