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.
Unfortunately, activation email could not send to your email. Please try again.

GGC Image in column Header

Thread ID:

Created:

Updated:

Platform:

Replies:

43676 Apr 28,2006 12:52 PM Jun 12,2006 12:42 PM Windows Forms 4
loading
Tags: GridControl
Chris Wescott
Asked On April 28, 2006 12:52 PM

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

Administrator [Syncfusion]
Replied On May 1, 2006 12:19 AM

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.

Chris Wescott
Replied On June 8, 2006 11:26 AM

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

Administrator [Syncfusion]
Replied On June 9, 2006 12:56 AM

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.

Chris Wescott
Replied On June 12, 2006 12:42 PM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;