DataGridViewRowPrePaintEventArgs.ClipBounds Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the area of the DataGridView that needs to be repainted.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public Rectangle ClipBounds { get; set; }

Property Value

Type: System.Drawing.Rectangle

A Rectangle that represents the area of the DataGridView that needs to be repainted.

The ClipBounds property represents the area of the DataGridView that needs to be repainted. For example, if a user covers the entire DataGridView with another window and then uncovers it, then ClipBounds represents the entire DataGridView. If a user covers a small area of the DataGridView and then uncovers it, then ClipBounds represents the small area that was covered.

The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the DataGridView.RowPrePaint event. This report helps you to learn when the event occurs and can assist you in debugging.

To run the example code, paste it into a project that contains an instance of type DataGridView named DataGridView1. Then ensure that the event handler is associated with the DataGridView.RowPrePaint event.

private void DataGridView1_RowPrePaint(Object sender, DataGridViewRowPrePaintEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ClipBounds", e.ClipBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "InheritedRowStyle", e.InheritedRowStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsFirstDisplayedRow", e.IsFirstDisplayedRow );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsLastVisibleRow", e.IsLastVisibleRow );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "PaintParts", e.PaintParts );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowBounds", e.RowBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowPrePaint Event" );
}

.NET Framework
Available since 2.0
Return to top
Show: