<分区>
我有一个没有边框的窗口。我在网上搜索了圆角,但都带有边框。如何制作 (不带边框)
形式的圆角?有办法吗?
我是c#的新手,所以请解释...
谢谢
<分区>
我有一个没有边框的窗口。我在网上搜索了圆角,但都带有边框。如何制作 (不带边框)
形式的圆角?有办法吗?
我是c#的新手,所以请解释...
谢谢
最佳答案
试试这个:
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
[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, // width of ellipse
int nHeightEllipse // height of ellipse
);
public Form1()
{
InitializeComponent();
this.FormBorderStyle = FormBorderStyle.None;
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20));
}
}
}
关于c# - C# Windows 窗体中的圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18822067/