Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridViewRowPostPaintEventArgs.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.RowPostPaint 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.RowPostPaint event.

private void DataGridView1_RowPostPaint(Object sender, DataGridViewRowPostPaintEventArgs 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}", "RowBounds", e.RowBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RowPostPaint Event" );
}

.NET Framework
Available since 2.0
Return to top
Show:
© 2018 Microsoft