惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - xujh

C# 同步两个子目录文件 ASP.NET中突破上传4M文件的限制 【转】一种在SQLServer中实现Sequence的高效方法 DevExpress的ASPxGridView中实现Master-Detail数据动态绑定 【转】浅谈:国内软件公司为何无法做大做强? - xujh - 博客园 一个正则表达式测试(只可输入中文、字母和数字) - xujh - 博客园 IE6、7下如何设置页面内部件高度和窗口等高(heihgt:100%) HP大中华区总裁孙振耀退休感言 C#的一个双缓冲显示的例子 【ASP.NET】防止ASP.NET按钮多次提交的办法 【ASP.NET】FCKeditor 2.6 + Asp.Net 设置 【ASP.NET】FreeTextBox的使用方法 在VS2005下配置手机设备仿真器访问局域网 [Delphi] 截屏存盘 有意思的加菲猫语录 [Delphi]用Delphi7访问.NET 2.0的WebService 转贴[ASP.NET]基于Forms认证的WebService应用 ASP.NET优秀博客搜集 [转贴]DataGrid中的高级ToolTip
C# 画圆角矩形
xujh · 2007-04-17 · via 博客园 - xujh

protected void Page_Load(object sender, EventArgs e)
{
        Bitmap bm 
= new Bitmap(800600);
        Graphics g 
= Graphics.FromImage(bm);
        g.FillRectangle(Brushes.White,
new Rectangle(0,0,800,600));
        FillRoundRectangle(g,Brushes.Plum,
new Rectangle(100100100100), 8);
        DrawRoundRectangle(g, Pens.Yellow,
new Rectangle(100100100100), 8);
        bm.Save(Response.OutputStream, ImageFormat.Jpeg);
        g.Dispose();
        bm.Dispose();
}

 
public static void DrawRoundRectangle(Graphics g,Pen pen,Rectangle rect, int cornerRadius)
{
        
using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius))
        
{
            g.DrawPath(pen, path);
        }

}

public static void FillRoundRectangle(Graphics g, Brush brush,Rectangle rect, int cornerRadius)
{
        
using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius))
        
{
            g.FillPath(brush, path);
        }

}

internal static GraphicsPath CreateRoundedRectanglePath(Rectangle rect, int cornerRadius)
{
        GraphicsPath roundedRect 
= new GraphicsPath();
        roundedRect.AddArc(rect.X, rect.Y, cornerRadius 
* 2, cornerRadius * 218090);
        roundedRect.AddLine(rect.X 
+ cornerRadius, rect.Y, rect.Right - cornerRadius * 2, rect.Y);
        roundedRect.AddArc(rect.X 
+ rect.Width - cornerRadius * 2, rect.Y, cornerRadius * 2, cornerRadius * 227090);
        roundedRect.AddLine(rect.Right, rect.Y 
+ cornerRadius * 2, rect.Right, rect.Y + rect.Height - cornerRadius * 2);
        roundedRect.AddArc(rect.X 
+ rect.Width - cornerRadius * 2, rect.Y + rect.Height - cornerRadius * 2, cornerRadius * 2, cornerRadius * 2090);
        roundedRect.AddLine(rect.Right 
- cornerRadius * 2, rect.Bottom, rect.X + cornerRadius * 2, rect.Bottom);
        roundedRect.AddArc(rect.X, rect.Bottom 
- cornerRadius * 2, cornerRadius * 2, cornerRadius * 29090);
        roundedRect.AddLine(rect.X, rect.Bottom 
- cornerRadius * 2, rect.X, rect.Y + cornerRadius * 2);
        roundedRect.CloseFigure();
        
return roundedRect;
}