【发布时间】:2011-03-29 18:02:47
【问题描述】:
我有一个没有边框(无边框)的 WinForm。如何在表单中添加 1px 黑色边框?
public MainForm()
{
InitializeComponent();
this.DoubleBuffered = true;
Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 10, 10)); // adjust these parameters to get the lookyou want.
}
[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
);
我需要一个无边框的表单,但我想添加一个 1px 的边框。
【问题讨论】:
-
我们能看到一些代码吗?最好是designer.cs
标签: c# .net winforms visual-studio