开发者

Automatic form-positioning

开发者 https://www.devze.com 2023-04-06 19:30 出处:网络
I want my application to have an auto form-positioning behaviour, similar to the WinAmp MP3 player. I\'d like window开发者_C百科s to stick to each other, so that if you move one window the other windo

I want my application to have an auto form-positioning behaviour, similar to the WinAmp MP3 player. I'd like window开发者_C百科s to stick to each other, so that if you move one window the other windows follow the movement. How can I do that?

I tried something like this.

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


May be using StartPosition property: FormStartPosition Enumeration

0

精彩评论

暂无评论...
验证码 换一张
取 消