使用C#绘制矩形,我需要首先绘制每个边缘的弧我绘制矩形,然后我需要单击按钮它将在边缘绘制弧,我该怎么办?
我正在使用此代码来创建带有圆边的表单(FormBorderStyle = none):
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // height of ellipse
int nHeightEllipse // width of ellipse
);
public Form1()
{
InitializeComponent();
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
}
Run Code Online (Sandbox Code Playgroud)
这是在Paint事件上设置自定义边框:
ControlPaint.DrawBorder(e.Graphics, this.ClientRectangle, Color.Black, 5, ButtonBorderStyle.Solid, Color.Black, 5, ButtonBorderStyle.Solid, Color.Black, 5, ButtonBorderStyle.Solid, Color.Black, …Run Code Online (Sandbox Code Playgroud) 我有一个没有边框的窗户.我搜索网的圆角,但都有边框.如何制作表格的圆角(not with borders)?有没有办法做到这一点?
我是c#的新手,所以请解释一下......
谢谢