InvalidateEventArgs.InvalidRect プロパティ

定義

無効化されたウィンドウ領域を含む Rectangle を取得します。

public:
 property System::Drawing::Rectangle InvalidRect { System::Drawing::Rectangle get(); };
public System.Drawing.Rectangle InvalidRect { get; }
member this.InvalidRect : System.Drawing.Rectangle
Public ReadOnly Property InvalidRect As Rectangle

プロパティ値

無効化されたウィンドウ領域。

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの Control.Invalidated 発生を報告します。 このレポートは、イベントが発生したタイミングを確認するのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントを報告するには、 を Console.WriteLine に置き換えるかMessageBox.Show、複数行TextBoxにメッセージを追加することを検討してください。

コード例を実行するには、 や ComboBoxなどの をControl継承する型のインスタンスを含むプロジェクトにButton貼り付けます。 次に、インスタンス Control1 に名前を付け、イベント ハンドラーがイベントに Control.Invalidated 関連付けられていることを確認します。

private void Control1_Invalidated(Object sender, InvalidateEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "InvalidRect", e.InvalidRect );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Invalidated Event" );
}
Private Sub Control1_Invalidated(sender as Object, e as InvalidateEventArgs) _ 
     Handles Control1.Invalidated

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "InvalidRect", e.InvalidRect)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Invalidated Event")

End Sub

適用対象

こちらもご覧ください