PaintEventArgs.ClipRectangle Vlastnost

Definice

Získá obdélník, ve kterém má malovat.

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

Hodnota vlastnosti

Do Rectangle kterého malovat.

Příklady

Následující příklad kódu ukazuje použití tohoto členu. V příkladu obslužná rutina události hlásí výskyt Control.Paint události. Tato sestava vám pomůže zjistit, kdy k události dojde, a může vám pomoct s laděním.

Pokud chcete spustit ukázkový kód, vložte ho do projektu, který obsahuje instanci typu, který dědí z Control, jako je například nebo ButtonComboBox. Potom instanci Control1 pojmenujte a ujistěte se, že obslužná rutina události je přidružená k Control.Paint události.

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

Platí pro

Viz také