winform GDI基础(二)画带圆角的矩形框
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基础(二)画带圆角的矩形框的更多相关文章
- winform GDI基础(一)
1获取画布 (1)从PaintEventArgs类中获取画布 private void Form1_Paint(object sender, PaintEventArgs e) { Graphics ...
- Winform GDI+绘图二:绘制旋转太极图
大家好,今天有时间给大家带来Winform自绘控件的第二部分,也是比较有意思的一个控件:旋转太极图. 大家可以停下思考一下,如果让你来绘制旋转的太极图,大家有什么样的思路呢?我今天跟大家展示一下,我平 ...
- winform GDI基础(四)简单截屏
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); G ...
- winform GDI基础(三)实现画笔
在程序窗口上使用鼠标画图 private Point pStart, pEnd; private bool isAllowDraw = false; private bool isOpenPen = ...
- Win32 GDI基础(笔记)
1.GDI名字的意义 GDI Graphic Device Interface,我说不清和GUI有什么区别.可能一种针对设备,一种针对用户而言吧,反正以后都说GDI,也就是Windows的图形编程. ...
- 《C# GDI+ 破境之道》:第一境 GDI+基础 —— 第三节:画圆形
有了上一节画矩形的基础,画圆形就不要太轻松+EZ:)所以,本节在画边线及填充上,就不做过多的讲解了,关注一下画“随机椭圆”.“正圆”.“路径填充”的具体实现就好.与画矩形相比较,画椭圆与之完全一致,没 ...
- WinForm GDI+ 资料收集
UI(User Interface)编程在整个项目开发过程中是个颇为重要的环节,任何好的解决方案若没有良好的用户界面呈现给最终用户,那么就算包含了最先进的技术也不能算是好程序.UI编程体现在两个方面, ...
- CSS 奇思妙想 | 巧妙的实现带圆角的三角形
之前在这篇文章中 -- <老生常谈之 CSS 实现三角形>,介绍了 6 种使用 CSS 实现三角形的方式. 但是其中漏掉了一个非常重要的场景,如何使用纯 CSS 实现带圆角的三角形呢?,像 ...
- Bootstrap <基础二十二>超大屏幕(Jumbotron)
Bootstrap 支持的另一个特性,超大屏幕(Jumbotron).顾名思义该组件可以增加标题的大小,并为登陆页面内容添加更多的外边距(margin).使用超大屏幕(Jumbotron)的步骤如下: ...
随机推荐
- puppeteer
const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); ...
- iptables的启动和关闭【转载】
原文网址:http://os.51cto.com/art/201103/249049.htm iptables的启动和关闭: 1.启动和关闭iptables 下面将正式使用iptables来创建防火墙 ...
- 2.Linux下安装Jenkins
1.安装jenkins的前提是安装好jdk环境,自行安装jdk,若安装成功后,使用一下命令即可成功安装jenkins: wget -O /etc/yum.repos.d/jenkins.repo ht ...
- unix下网络编程之I/O复用(四)
首先需要了解的是select函数: select函数 #include<sys/select.h> #include<sys/time.h> int select (int m ...
- POJ3421(质因数分解)
X-factor Chains Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6501 Accepted: 2023 D ...
- debug的时候出现停在ThreadPoolexecutor.class文件中停留的解决办法
原因: The posted stack trace indicates that a RuntimeException was encountered in a Daemon thread. Thi ...
- C字符串翻转
实现字符串翻转,思路很简单,就是首尾字符对调. void reverse(char* str){ char* p = str + strlen(str) - 1;//最后一个字符地址 char tem ...
- Oracle中REGEXP_SUBSTR函数(字符串转多行)
Oracle中REGEXP_SUBSTR函数 Oracle中REGEXP_SUBSTR函数的使用说明: 题目如下: 在oracle中,使用一条语句实现将'17,20,23'拆分成'17','20',' ...
- 删除CentOS系统自带的jdk
转自:https://www.cnblogs.com/linjiqin/archive/2013/03/23/2977377.html 在安装CentOS6.4时,系统会自动安装jdk,先把它下载掉, ...
- Hadoop YARN: 1/1 local-dirs are bad: /var/lib/hadoop-yarn/cache/yarn/nm-local-dir; 1/1 log-dirs are bad: /var/log/hadoop-yarn/containers hdfs硬盘90% yarn unhealthy
1/1 local-dirs are bad: /var/lib/hadoop-yarn/cache/yarn/nm-local-dir; 1/1 log-dirs are bad: /var/log ...