PaintEventArgs.ClipRectangle プロパティ

定義

描画先の四角形を取得します。

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

プロパティ値

描画先の Rectangle

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの Control.Paint 発生を報告します。 このレポートは、イベントが発生したタイミングを確認するのに役立ち、デバッグに役立ちます。

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

private void Control1_Paint(Object sender, PaintEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ClipRectangle", e.ClipRectangle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Paint Event" );
}
Private Sub Control1_Paint(sender as Object, e as PaintEventArgs) _ 
     Handles Control1.Paint

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

End Sub

適用対象

こちらもご覧ください