c# - 如何使用 WinForms (.NET) 绘制圆角矩形?

标签 c# .net winforms

使用 C# 绘制矩形,我需要先在每条边上绘制圆弧,然后我需要单击按钮,它会在边缘绘制圆弧,我该怎么做?

最佳答案

C# 中的图形类没有用于绘制圆角矩形的内置方法,但是有多种方法可以实现此效果。 Jay Riggs 答案中的链接提供关于从哪里开始的好建议,此外我建议您查看这篇文章:

C# - Creating Rounded Rectangles Using A Graphics Path

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...

关于c# - 如何使用 WinForms (.NET) 绘制圆角矩形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1967944/

相关文章:

c# - 如何以编程方式使标签的某些部分在 Windows 窗体中加粗?

c# - 为什么 "Func<bool> test = value ? F: F"不编译?

.net - Windows 工作流基础中命名工作流事件的约定是什么?

c# - 调试 ASP.NET session 状态服务器问题

.net - VS2017 15.8.2发布错误(.NET Core 2.1)

c# - 检测在 C# 库中的主线程中运行

c# - 处理 SignalR .Net 客户端中的异常

c# - 如何调试温莎解析容器的位置?

c# - 哪个 Windows 服务确保网络连接?

C# ToolTip 阻塞执行?