如何绘制一个圆角矩形用的WinForms(.NET)? [英] How to Draw a Rounded Rectangle with WinForms (.NET)?

查看:458
本文介绍了如何绘制一个圆角矩形用的WinForms(.NET)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

绘制矩形使用C#,我需要首先我绘制矩形,然后我需要点击按钮,它就会划出弧线的边缘,我该怎么办呢划出弧线在每边?

Draw rectangle using C# and I need to draw the arc in every edges first of all I draw rectangle and then I need click button it will draw the arc at edges, how can I do it?

推荐答案

Graphics类在C#中不具有内置的方法来绘制圆角矩形,但也有一些你可以做到这一点的影响几个方面。由<一个在答案的链接href="http://stackoverflow.com/questions/1967944/draw-rectangle-using-c-and-i-need-to-draw-the-arc-in-every-edges-how-can-i-do/1967958#1967958">Jay里格斯提供从哪里开始很好的建议,另外我建议你看看这篇文章:

The graphics class in C# does not have a built-in method to draw rounded rectangles, however there are several ways that you can accomplish this affect. The links in the answer by Jay Riggs offer good suggestions on where to start, additionally I would suggest that you check out this article:

所以首先,我们创建了一个GraphicsPath的,   然后我们称之为StartFigure使   我们可以开始添加边缘的路径。   这code剩下的就是为顶   左上角和的最上面一行   圆角矩形。如果我们假定   使这个角落圆角,我们增加了   弧 - 否则...

So first, we create a GraphicsPath, and then we call StartFigure so that we can start adding edges to the path. The rest of this code is for the top left corner and the top line of the rounded rectangle. If we are supposed to make this corner rounded, we add an arc - otherwise...

这篇关于如何绘制一个圆角矩形用的WinForms(.NET)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆