Styling and Appearance / Custom Glyphs
Custom Glyphs

FlexGrid lets you change the default glyph images used in the grid to indicate various actions such as column filtering and sorting. This behavior of grid is exposed through GridGlyphs class which is a collection of images used by the grid to represent filtered state, sorting order, checkbox states, and so on. These images can be accessed through Glyphs property of the C1FlexGrid class which accepts values from GlyphEnum enumeration.

Custom glyphs

To change the default glyphs used for filter editor and filtered column in FlexGrid, use the following code for .NET and .NET Framework, respectively.

In this example we create an object of Bitmap class to be used as a source for C1BitmapIcon object and then set it as a glyph for FilterEditor and FilteredColumn using the Glyphs property.

C#
Copy Code
//Create BitmapIcon object
C1.Framework.C1BitmapIcon icon1 = new C1.Framework.C1BitmapIcon();

//Create a Bitmap object set to the custom image you want for the glyph
Bitmap bitmap = new Bitmap("icon.png");

//Set the source for C1BitmapIcon object to the Bitmap object
icon1.Source = bitmap;

//Set the FilterEditor glyph to the C1BitmapIcon
c1FlexGrid1.Glyphs[GlyphEnum.FilterEditor] = icon1;
c1FlexGrid1.Glyphs[GlyphEnum.FilteredColumn] = icon1;
VB
Copy Code
'Create BitmapIcon object
C1.Framework.C1BitmapIcon icon1 = new C1.Framework.C1BitmapIcon()

' Create a Bitmap object set to the custom image you want for the glyph
Bitmap bitmap = new Bitmap("icon.png")

' Set the source for C1BitmapIcon object to the Bitmap object
icon1.Source = bitmap

' Set the FilterEditor glyph to the C1BitmapIcon
c1FlexGrid1.Glyphs[GlyphEnum.FilterEditor] = icon1
c1FlexGrid1.Glyphs[GlyphEnum.FilteredColumn] = icon1

Please note that setting Glyph property to null restores the default glyph. In order to hide a glyph, you can set the Glyph property to a blank image.