Automatic form-positioning

本文关键字:form-positioning Automatic | 更新日期: 2023-09-27 18:09:33

我希望我的应用程序具有自动表单定位行为,类似于WinAmp MP3播放器。我想让窗口彼此粘在一起,这样如果你移动一个窗口,其他窗口也会跟着移动。我该怎么做呢?

我试过这样做。

if (this.Size.Width + this.Location.X >= 1270)
    this.Location = new Point(1280 - this.Width, this.Location.Y); } //right x
if (this.Size.Height + this.Location.Y >= 750)
    this.Location = new Point(this.Location.X, 760 - this.Width); } // bottom y
if (this.Location.X <= 5)
    this.Location = new Point(0, this.Location.Y); } //left x
if (this.Location.Y <= 5)
    this.Location = new Point(this.Location.X, 0); } // top y

Automatic form-positioning

可能使用了StartPosition属性:FormStartPosition Enumeration