DataGrid::FlatMode Property

 

Gets or sets a value indicating whether the grid displays in flat mode.

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

public:
property bool FlatMode {
	bool get();
	void set(bool value);
}

Property Value

Type: System::Boolean

true if the grid is displayed flat; otherwise, false. The default is false.

The following code example examines the FlatMode property and notifies the user of its status.

   // Attach to event handler.
private:
   void AttachFlatModeChanged()
   {
      this->myDataGrid->FlatModeChanged +=
            gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_FlatModeChanged );
   }

   // Check if the 'FlatMode' property is changed.
   void myDataGrid_FlatModeChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      String^ strMessage = "false";
      if ( myDataGrid->FlatMode == true )
            strMessage = "true";

      MessageBox::Show( "Flat mode changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
   }

   // Toggle the 'FlatMode'.
   void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      if ( myDataGrid->FlatMode == true )
            myDataGrid->FlatMode = false;
      else
            myDataGrid->FlatMode = true;
   }

.NET Framework
Available since 1.1
Return to top
Show: