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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC col width & selected record event

Thread ID:





71912 Feb 20,2008 02:04 PM UTC Feb 25,2008 07:48 AM UTC WinForms 2
Tags: GridControl
Asked On February 20, 2008 02:04 PM UTC


I put image in ggc column header by this snippet:

sub ggc_TableControlDrawCell
Dim s As String = e.Inner.Style.Text
e.Inner.Style.ImageList = ImageList1
e.Inner.Style.Text = vbNullString '" "c
'//Draw the ColumnHeader cell in a Grid.
Dim crect As Rectangle = New Rectangle(e.Inner.Bounds.Location, New Size(e.Inner.Bounds.Size.Width - e.Inner.Style.ImageList.ImageSize.Width, e.Inner.Bounds.Height))
e.Inner.Renderer.Draw(e.Inner.Graphics, e.Inner.Bounds, e.Inner.RowIndex, e.Inner.ColIndex, e.Inner.Style)
'//Draw the image & text in a Grid.
Dim irect As Rectangle = New Rectangle(New Point(e.Inner.Bounds.Right - 5 - e.Inner.Style.ImageList.ImageSize.Width, e.Inner.Bounds.Top - 2), e.Inner.Style.ImageList.ImageSize)
e.Inner.Graphics.DrawString(s, e.Inner.Style.Font.GdipFont, New SolidBrush(e.Inner.Style.TextColor), crect)

e.Inner.Graphics.DrawImage(e.Inner.Style.ImageList.Images(2), irect) '//Draw the image in a Grid di kanan
e.Inner.Style.Text = s
e.Inner.Cancel = True
end sub

1. Problem: The header text was truncated most of times, how to make the column width automatic resize to fit the image and text to avoid truncated text?

2. What is the GGC event name for detecting any record row changed and fired only 1 time?

I used:
But the first time cell enter, it enumerated through all nested tables thus fired as many as nested tables, and next time it always fired two times?
I wish to get only 1 time event raised, since I need to get particular record calculated to a function if the user click another record row. What is the other way around?


Administrator [Syncfusion]
Replied On February 21, 2008 12:31 PM UTC

Hi Harry,

1) You can make the column width automatic resize to fit to the image and text by using GridImageCellModel as follows :

Private imageCell As GridImageCellModel = New GridImageCellModel(gridDataBoundGrid1.Model)
'setup how image is fitted to cell
Private imageCell.CellDrawOption = GridImageCellDrawOption.FitProportionally

Please refer the sample in the below link which illustrates the automatic resize of text and image.


2)You can use CurrentRecordContextChange instead of the SelectedRecordsChanged event that detect any record changed as follows.

Private Sub gridGroupingControl1_CurrentRecordContextChange(ByVal sender As Object, ByVal e As CurrentRecordContextChangeEventArgs)
If e.Action = CurrentRecordAction.EndEditComplete Then
End If
End Sub

You can also see the forum that discuss about the selection changed from the below link :


Please let me know if this helps you.


Replied On February 25, 2008 07:48 AM UTC

Hello Asem,

1. This code didn't work with GridGroupingControl:
Private imageCell As GridImageCellModel = New GridImageCellModel(gridDataBoundGrid1.Model)
'setup how image is fitted to cell

Is this code should be put in Form_Load event?
Private imageCell.CellDrawOption = GridImageCellDrawOption.FitProportionally

2. How to access specified record of particular column (e.g. "Description") by: e.record.... ?



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon