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.

How can I add a column in ggc that this colum contains Textbox in the left and a Picture in the right

Thread ID:

Created:

Updated:

Platform:

Replies:

70612 Dec 19,2007 04:32 AM Dec 27,2007 12:35 PM Windows Forms 3
loading
Tags: Grouping
Sean
Asked On December 19, 2007 04:32 AM

Hi:
How can I add a column in ggc that this colum contains Textbox in the left and a Picture in the right.
If I click the right side picture I also want to rise a event which I can put my code in to change the text in the left side textbox?

thanks


Administrator [Syncfusion]
Replied On December 19, 2007 08:40 AM

One way you can do it is to handle the TableControlCellDrawn event and draw the image yourself. Here is a little sample showing some details.



WindowsApplication24_2.zip

Sean
Replied On December 24, 2007 02:04 AM

Thanks,but I have another problem,I want to click the image to fire a event.How can I do this?


haneefm [Syncfusion]
Replied On December 27, 2007 12:35 PM

Hi Strife,

One way you can do this by handling the TableControlCellClick event of the grid and fire the Image clicked event. Below are the codes that shows this task.

void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (style.TableCellIdentity.Column != null
&& style.TableCellIdentity.Column.Name == "Col2"
&& style.TableCellIdentity.DisplayElement.GetRecord() is GridRecord)
{

GridTextBoxCellRenderer cr = e.TableControl.CellRenderers["TextBox"] as GridTextBoxCellRenderer;
Rectangle Cellrect = cr.GetCellClientRectangle(e.Inner.RowIndex, e.Inner.ColIndex, style, false);

Rectangle imgRect = new Rectangle(Cellrect.X + Cellrect.Width - style.TextMargins.Right, Cellrect.Y , style.TextMargins.Right, Cellrect.Height);
bool b = imgRect.IntersectsWith(new Rectangle(e.Inner.MouseEventArgs.Location, new Size(1, 1)));
if (b)
{
MessageBox.Show("Image Clicked....");
}

}
}

Best regards,
Haneef



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.

;