DataGridView::AutoSizeRowsModeChanged Event

 

Occurs when the value of the DataGridViewAutoSizeRowsMode property changes.

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

public:
event DataGridViewAutoSizeModeEventHandler^ AutoSizeRowsModeChanged {
	void add(DataGridViewAutoSizeModeEventHandler^ value);
	void remove(DataGridViewAutoSizeModeEventHandler^ value);
}

For more information about handling events, see NIB: Consuming Events.

The following code example illustrates the use of this event. This example is part of a larger example available in How to: Automatically Resize Cells When Content Changes in the Windows Forms DataGridView Control.

void WatchRowsModeChanges( Object^ /*sender*/, DataGridViewAutoSizeModeEventArgs^ modeEvent )
{
   Label^ label = dynamic_cast<Label^>(flowLayoutPanel1->Controls[ currentLayoutName ]);
   if ( modeEvent->PreviousModeAutoSized )
   {
      label->Text = String::Format( "changed to a different {0}{1}", label->Name, dataGridView1->AutoSizeRowsMode );
   }
   else
   {
      label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode );
   }
}


.NET Framework
Available since 2.0
Return to top
Show: