This sample illustrates the various options to customize the cells in grid.
"Floating Cell" is a term used to describe cells with content that occupies adjacent, empty cells. The values of these cells float over the neighboring cells.
Features:
Support for floating cells and their initialization.
Interactive Features:
With FloatCellsMode property, the behavior of floating cells in Grid model can be set.
The covered cell is obtained by grouping a range of cells and modifying their behavior to act as a large single cell.
Features:
Bitmaps or other controls can be embedded into a Covered Cell.
Appearance of a covered cell is determined by the GridStyleInfo object on the top-left cell in the covered range.
The border for a Covered Cell can be set by modifying the border of the top-left cell of a covered range.
In general, cell style properties of the top-left cell determine properties of the Covered Cell.
Banner cells are multiple cells spanned by a single background image.
Features:
Load the image to be displayed in a banner cell from a local disk by setting the BackgroundImage property for the cell and applying a banner to the cell area.
Alternatively, choose to display a gradient among the cells.
Draw custom cell background by handling the DrawCellBackground event.
Banner cells can also be defined through a recurring pattern when you handle the QueryBanneredRange event.
Banner area (image area spanned across grid cells) doesn’t affect cell value but acts as a placeholder for images placed on the top-left cell.
To view a background image, create a bannered range and set the background image
Background color for a cell can be set using GradientStyle
QueryBanneredRange event has been handled to provide bannered cell ranges on demand.
Custom cell backgrounds can be drawn in bannered ranges using the DrawCellBackground handler.
For a gradient row header, set the banner range in the QueryBanneredRange handler and describe Style.Interior. This lets you specify a solid background color, gradient, or pattern style with both background color and foreground color as a cell’s background.
The use of GridStyleInfo.BorderMargins and GridControlBase.DrawCellFrameAppearance events in drawing custom borders around cells is illustrated. Some cells show a texture-brush border, while others show a gradient border.
Features:
DrawCellFrameAppearance event can be used with any cell type. This sample shows cells with text boxes, check boxes, covered ranges, and bannered ranges.
For image or gradient style painting around a cell, use Graphics.FillRectangle in the DrawCellFrameAppearance handler.
In the sample, the border between Column 5 and 6 is a solid right and solid left border drawn usingDrawCellFrameAppearance handler.
Covered Ranges create a covered area and behaves as one cell. The cell style properties of the top-left cell determine the properties of the Covered Cell.
BanneredRanges create a banner area. The area spans across a set of grid cells without affecting cell values and also acts as a placeholder for images placed on the top-left cell.
Cells (2,3) and (8,5) demonstrate the difference between covered ranges and the bannered ranges.
Custom Draw in Grid cells demonstrates handling custom painting in grid cells. Essential Grid contains many custom draw events such as CellDrawn and DrawCell to provide required look and feel to the application.
Features:
You can subscribe to the CellDrawn event and use e.Graphics to draw, after the grid completes the process of drawing the cell.
The DrawCell event can be subscribed to draw any cell before the grid draws the specified one.