PaintEventArgs.ClipRectangle Propiedad

Definición

Obtiene el rectángulo en el que se va a pintar.

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

Valor de propiedad

Rectangle en el que se va a pintar.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de este miembro. En el ejemplo, un controlador de eventos informa sobre la aparición del Control.Paint evento. Este informe le ayuda a aprender cuándo se produce el evento y puede ayudarle a depurar.

Para ejecutar el código de ejemplo, péguelo en un proyecto que contenga una instancia de un tipo que herede de Control, como o ComboBoxButton . A continuación, asigne un nombre a la instancia Control1 y asegúrese de que el controlador de eventos está asociado al Control.Paint evento.

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

Se aplica a

Consulte también