2012-03-18 3 views
0

私のForm1の移動イベントでは、私はその位置をチェックし、ユーザーの視野からそれを戻す場合は戻します。彼はそれを動かし終わったときに発砲する出来事はありますか?移動イベントは移動中に発生するため、移動後に移動イベントが必要です。ここに私のコードは、これまでのところです:ウィンドウが畳まずにMDIから離れることを防止しますか?

private void PublicTicker_Move(object sender, EventArgs e) 
    { 
     if (this.Left < 0) 
     { this.Left = 0; } 

     else if (this.Left > this.MdiParent.ClientRectangle.Width - this.Width) 
     { this.Left = this.MdiParent.ClientRectangle.Width - this.Width; } 

     if (this.Top < 3) 
     { this.Top = 3; } 

     else if (this.Top > this.MdiParent.ClientRectangle.Height - this.Height) 
     { this.Top = this.MdiParent.ClientRectangle.Height - this.Height; } 
    } 
+0

[移動フォームのみ垂直](http://stackoverflow.com/questions/4302440/move-form-only-vertically) –

答えて

1

ResizeEndイベントにあなたの移動補正ルーチンを実行してください。意外にも、フォームがサイズ変更されるときだけでなく、ユーザーがフォームを移動するときにも起動されます。

続きを読むForm.ResizeEnd Event

+0

ありがとう、ちょうど私が探していた! – Oztaco

関連する問題