フォームの位置と大きさ
フォームの位置を変更する
this.Location = new Point(10, 10);
フォームの位置をデスクトップ座標で変更する
this.SetDesktopLocation(10, 50);
this.DesktopLocation = new Point(10, 50);
(どっちども同じ)
フォームの位置とサイズを変更する
//位置と大きさを変更(BoundsSpecified.Allは省略可能)
this.SetBounds(10, 50, 200, 100, BoundsSpecified.All);
//位置だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Location);
//大きさだけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Size);
//幅だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Width);
//高さだけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Height);
//X座標だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.X);
//Y座標だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Y);
//変更しない
this.SetBounds(10, 50, 200, 100, BoundsSpecified.None);
もしくは
this.Bounds = new Rectangle(10, 50, 200, 100);
0 件のコメント:
コメントを投稿