Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
AutoSizeRowsModeChanged Event
Collapse the table of content
Expand the table of content

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)

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

For more information about handling events, see 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 );
         label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode );

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft