ComponentOne FlexGrid for WinForms
C1FlexGrid Class
Members  Example 

C1.Win.C1FlexGrid Namespace : C1FlexGrid Class

The C1FlexGrid control is a powerful, full-featured grid.

C1FlexGrid provides advanced features such as outline trees, cell merging, masked editing, translated combo and image lists, owner-draw cells, and automatic data aggregation.

Object Model
C1FlexGrid ClassColumnCollection ClassColumn ClassComboBoxEditor ClassCellRange StructureFooters ClassGridGlyphs ClassCellRangeCollection ClassCellRange StructureNode ClassGridPrinter ClassC1FlexGridRenderer ClassRowCollection ClassRow ClassCellRange StructureColumn ClassCellStyleCollection ClassCellStyle ClassGridTree Class
Syntax
'Declaration
 
Public Class C1FlexGrid 
   Inherits C1FlexGridBase
public class C1FlexGrid : C1FlexGridBase 
Remarks

This class helps in enabling/disabling the following operations/behaviors for the FlexGrid control:

Grid Operations:

Row/Column Operations:

Cell Operations:

Keyboard Operations:

Edit Operations:

Example

This code example depicts how we can initialize the FlexGrid control in bound mode and display a tooltip for each cell:

C1FlexGrid _flex;
ToolTip _toolTip;

private void Form1_Load(object sender, EventArgs e)
{
   //Initialize and bind the FlexGrid control           
   _flex = new C1FlexGrid();
   _flex.Location = new System.Drawing.Point(20, 80);
   _flex.Size = new System.Drawing.Size(800,500);
   _flex.DataSource = productsTable;            
   this.Controls.Add(_flex);            

   //Bind events to use a custom editor and display the tooltip 
   _flex.StartEdit += _flex_StartEdit;
   _flex.MouseMove += _flex_MouseMove;

   //Initialize the tooltip control used to display the tooltip for each cell
   _toolTip = new ToolTip();            
}       
private void _flex_MouseMove(object sender, MouseEventArgs e)
{
   //To show Tooltip when mouse is moved over the grid. Initialize and bind the FlexGrid control
   HitTestInfo hitTestInfo = _flex.HitTest(e.Location);            
   _toolTip.SetToolTip(_flex,String.Format("Mouse is over the ({0},{1}) cell \n Cell Type is : {2}", new object[] { hitTestInfo.Row, hitTestInfo.Column ,hitTestInfo.Type}));
}

private void _flex_StartEdit(object sender, RowColEventArgs e)
{
   if (_flex.Cols[e.Col].Name == "UnitsInStock")
   {
      //Setting the grid's Editor property
      _flex.Editor = new NumericUpDown();
   }
}
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         System.Windows.Forms.Control
               C1.Win.C1FlexGrid.C1FlexGridBase
                  C1.Win.C1FlexGrid.C1FlexGrid

See Also

Reference

C1FlexGrid Members
C1.Win.C1FlexGrid Namespace