We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GGC Image in column Header

HI, I was wondering if it is possible to add an image to the header cell of a GGC. I just need to show a little filter funnel or something to let the user know that the column has been filtered. Regards, Chris Wescott

4 Replies

AD Administrator Syncfusion Team May 1, 2006 04:19 AM UTC

Hi Chris, Yes, it is possible to draw an image in the column header cell by handling the TableControlCellDrawn event. Below is a code snippet. Please also refer the sample TestErrorProvider in Syncfusion\Essential Studio\4.1.0.62\windows\Grid.Grouping.Windows\Samples\TestErrorProvider\ Private Sub gridGroupingControl1_TableControlCellDrawn(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs) Dim style As GridTableCellStyleInfo = CType(e.Inner.Style, GridTableCellStyleInfo) Dim ct As GridTableCellType = style.TableCellIdentity.TableCellType If ct = GridTableCellType.ColumnHeaderCell AndAlso style.TableCellIdentity.Column.Name = "Value" Then Try GridStaticCellRenderer.DrawImage(e.Inner.Graphics, Me.imageList, 0, e.Inner.Bounds, False) Catch End Try End If End Sub Regards, Calvin.


CW Chris Wescott June 8, 2006 03:26 PM UTC

This Work Great!!, I just need a way to clear the image when I clear the sorting. ie, button click event, clear sort, needs to remove these images. Regards, Chris Wescott


AD Administrator Syncfusion Team June 9, 2006 04:56 AM UTC

Hi Chris, You can try having a flag and setting it in the button click event and then draw the image in the CellDrawn event handler accordingly. Below is a code snippet. Private flag As Boolean = True Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click If Me.flag Then Me.flag = False Else Me.flag = True End If Me.gridGroupingControl1.TableControl.Invalidate() End Sub ''button1_Click Private Sub gridGroupingControl1_TableControlCellDrawn(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs) Dim style As GridTableCellStyleInfo = CType(e.Inner.Style, GridTableCellStyleInfo) Dim ct As GridTableCellType = style.TableCellIdentity.TableCellType If ct = GridTableCellType.ColumnHeaderCell AndAlso style.TableCellIdentity.Column.Name = "Value" AndAlso Me.flag Then Try GridStaticCellRenderer.DrawImage(e.Inner.Graphics, Me.imageList, 0, e.Inner.Bounds, False) Catch End Try End If End Sub ''gridGroupingControl1_TableControlCellDrawn Regards, Calvin.


CW Chris Wescott June 12, 2006 04:42 PM UTC

Hi, Thanks that worked but for future users I changed the cell drawn function to look like this Private Sub gridGroupingControl1_TableControlCellDrawn(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlDrawCellEventArgs) > Dim style As GridTableCellStyleInfo = CType(e.Inner.Style, GridTableCellStyleInfo) > > Dim ct As GridTableCellType = style.TableCellIdentity.TableCellType > If ct = GridTableCellType.ColumnHeaderCell AndAlso style.TableCellIdentity.Column.Name = "Value" Then > > Try if flag = true then > GridStaticCellRenderer.DrawImage(e.Inner.Graphics, Me.imageList, 0, e.Inner.Bounds, False) else > GridStaticCellRenderer.DrawImage(e.Inner.Graphics, Nothing, 0, e.Inner.Bounds, False) end if > Catch > End Try > End If > > End Sub ''gridGroupingControl1_TableControlCellDrawn Regards, Chris Wescott

Loader.
Live Chat Icon For mobile
Up arrow icon