This grid control is an advanced list control set to "Report" view that uses the custom-draw mechanism to paint itself. It provides a lot of extra features and the ability to easily add new ones.
Being a grid, it is divided into cells (not just rows). The cursor moves horizontally, too.
Multiple cell types
Cells are more than just blind text displayed; they can be edited. Currently, the following cell types are available:
Regular cell (blind text)
Edit box (Screenshot: Col1 has 5 edit box cells)
Combo box (Screenshot: Col2 has combo box cells)
Editable combo box (Screenshot: Col3 has editable combo cells)
Check box (Screenshot: Col5 has check box cells)
Custom edit (Ellipsis) (Screenshot: Col4 has ellipsis cell)
Separator (Screenshot: Row11 has separators)
New cell types can easily be added.
Inplace combo boxes with images
Combo box and Editable combo box cells, can display images when they are dropped down. When an item is edited, its new (text) value AND the corresponding image are applied.
You can select multiple cells simultaneously (see screenshot).
After editing a cell, its new value applies to the entire selection
The grid has a complex colouring system. First of all, it has a global color scheme applied by default to all its cells. Initially, this global color scheme uses the default Windows colors. Secondly, each cell can have overridden colors (and fonts).
Beside custom colors, each cell can have it's own font style. Currently is supported any combination of: bold, italic, underline and strikeout. For instance, in the screenshot, Col5 is BOLD + ITALIC, Col6 is UNDERLINE + STRIKEOUT.
Custom cell drawing
If you are not satisfied with the default behavior, you can easily custom draw any cell.
If you start typing a string, the selection jumps to the first cell that matches it.
Using the code
Being a list control, the grid is to be used the same way. First of all, insert some columns with
InsertColumn. Then, insert items with
InsertItem. Insert subitems using
- Multi-selection is disabled by default. In order to enable, open the resource editor, select the list control, set it to report view and set "Single Selection" to
- The grid will NOT work with
- The grid was NOT tested with sorted columns. It might work, though...
For using the advanced features, you could take a look at the demo project... It's well commented.