Skip to main content
 首页 » 编程设计

c#之更改无边框窗体的位置 (C#)

2024年02月23日11Terrylee

如何将无边界 (FormBorderStyle.None) 表单移出窗口(= 负坐标)?

我已经尝试过以下方法:

  • this.Location = new Point(-10, -10);
  • 来自 user32.dll 的 MoveWindow()
  • 来自 user32.dll 的 SetWindowPos()

有什么想法吗?

请您参考如下方法:

答案是; (在多显示器下不起作用)

this.Location = new Point(-1 * this.Width, -1 * this.Height); 

您可以通过设置隐藏您的窗口;

this.Visible = false;