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
精彩评论