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.

RichText in Virtual Grid Cell , get the underlying Renderer Control

Thread ID:

Created:

Updated:

Platform:

Replies:

69160 Oct 16,2007 09:56 PM Oct 24,2007 08:08 PM Windows Forms 2
loading
Tags: GridControl
Sean Sheldon
Asked On October 16, 2007 09:56 PM

Hi,

We are using Rich Text, to display rich text in each cell in the grid. We are not using custom renderer, but the built in rendering for rich text. We also have a click event registered for the grid. When the grid is clicked we would like to get the underlying richtext control associated with the cell, so that we can locate the string clicked on.

Is is possible to get the underlying richtext control associated with the cell? We need this since the mouse event for the click can get me the character and eventually the string clicked on.

If not how do I get the string clicked on in the cell that has richtext?

Thanks




Sean Sheldon
Replied On October 16, 2007 09:59 PM

We have strings separated by spaces.

>Hi,

We are using Rich Text, to display rich text in each cell in the grid. We are not using custom renderer, but the built in rendering for rich text. We also have a click event registered for the grid. When the grid is clicked we would like to get the underlying richtext control associated with the cell, so that we can locate the string clicked on.

Is is possible to get the underlying richtext control associated with the cell? We need this since the mouse event for the click can get me the character and eventually the string clicked on.

If not how do I get the string clicked on in the cell that has richtext?

Thanks




Rajagopal [Syncfusion]
Replied On October 24, 2007 08:08 PM

Hi,

To get access to the underlying richtext control in a cell you need to cast the clicked cell renderer as GridRichTextBoxCellRenderer and iterate through the Controls collection of the GridRichTextEntryPanel as in the below code.

GridCellRendererBase renderer = this.gridControl1.GetCellRenderer(row, col);
if (renderer is GridRichTextBoxCellRenderer)
{
GridRichTextBoxCellRenderer rtr = renderer as GridRichTextBoxCellRenderer;
foreach (Control c in rtr.DropDownContainer.Controls)
{
foreach (Control ct in (c as GridRichTextEntryPanel).Controls)
{
if (ct is RichTextBox)
{
RichTextBox rt = ct as RichTextBox;
}
}
}
}

You can get the string that is clicked on using the GetCharFromPosition() method of the RichTextBox. Please refer the below sample for more details on this.

Here is a sample
http://websamples.syncfusion.com/samples/Grid.Windows/F69160/main.htm

Let me know if you have any questions.

Thanks for using Syncfusion Products.

Regards,
Rajagopal

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.

;