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.

Formating text in Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

45709 Jun 27,2006 11:38 AM Jun 27,2006 03:13 PM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 27, 2006 11:38 AM

Hi, I am using Syncfusion Grid Grouping Control - V 3.2.1.0 and i need to format text in the cell. I have reffered Syncfusion sample - Essential Grid Samples - Cell Types- Rich Text Cells. However this allows editing of the cell. How do we disable this? Thanks in advance.

Administrator [Syncfusion]
Replied On June 27, 2006 12:26 PM

Hi Deepa, Regarding the Question 1: Format the cells. The TextFormat browser sample shows you how to format the data in your grid. You can see the code that formats numbers and dates. It also has code that does the validation on the cell values as you leave the cell. Essential Grid uses the .Net Framework formatting support so that there is no additional learning curve involved. As a result of the .Net Framework, the formatting is culture sensitive. Here is a path. Essential Grid Samples - >Quick Start ->TextFormat. Syncfusion\Essential Studio\4.2.0.37\windows\Grid.Windows\Samples\Quick Start\TextFormat Regarding the Question 2: You need to handle the CurrentCellshowngDropDown event for cancelling the editing of the dropdown RichTextBox cell in a grid. Here is a code snippet. GridCurrentCell cc = this.gridControl1.CurrentCell; GridRichTextBoxCellRenderer cr = cc.Renderer as GridRichTextBoxCellRenderer; if( cr!= null) { foreach(Control c in cr.DropDownContainer.Controls) { if ( c is GridRichTextEntryPanel) { GridRichTextEntryPanel panel = c as GridRichTextEntryPanel; foreach(Control subc in panel.Controls) { if( subc is RichTextBox) { RichTextBox rich = subc as RichTextBox; rich.ReadOnly = true; } } } } } Let me know if this helps. Best Regards, Haneef

Administrator [Syncfusion]
Replied On June 27, 2006 01:38 PM

Hi, I want to use Rich Text Format. I want to format the text based on colors. Also i dont want the drop down button itself. Please refer to Syncfusion\Essential Studio\3.2.1.0\Windows\Grid.Windows\Samples\CellTypes\RichTextCells. Thanks >Hi Deepa, > >Regarding the Question 1: Format the cells. > >The TextFormat browser sample shows you how to format the data in your grid. You can see the code that formats numbers and dates. It also has code that does the validation on the cell values as you leave the cell. Essential Grid uses the .Net Framework formatting support so that there is no additional learning curve involved. As a result of the .Net Framework, the formatting is culture sensitive. > >Here is a path. >Essential Grid Samples - >Quick Start ->TextFormat. >Syncfusion\Essential Studio\4.2.0.37\windows\Grid.Windows\Samples\Quick Start\TextFormat > >Regarding the Question 2: > >You need to handle the CurrentCellshowngDropDown event for cancelling the editing of the dropdown RichTextBox cell in a grid. Here is a code snippet. > >GridCurrentCell cc = this.gridControl1.CurrentCell; >GridRichTextBoxCellRenderer cr = cc.Renderer as GridRichTextBoxCellRenderer; >if( cr!= null) >{ > foreach(Control c in cr.DropDownContainer.Controls) > { > if ( c is GridRichTextEntryPanel) > { > GridRichTextEntryPanel panel = c as GridRichTextEntryPanel; > foreach(Control subc in panel.Controls) > { > if( subc is RichTextBox) > { > RichTextBox rich = subc as RichTextBox; > rich.ReadOnly = true; > > } > } > } > } >} > >Let me know if this helps. >Best Regards, >Haneef

Administrator [Syncfusion]
Replied On June 27, 2006 03:13 PM

Hi Deepa, Regarding the drop down button: Try setting the ShowButtons property to GridShowButtons.Hide to hide the dropdown button in a cell. Here is a code snippet this.gridControl1.TableStyle.ShowButtons = GridShowButtons.Hide; Regarding the text formatting based on selection color: To format the text based on selection color of the RichText cell in a grid, you need to handle the PrepareViewStyleInfo event. Here is a code snippet. if(e.Style.CellType == "RichText" && e.Style.Tag == null) { RichTextBox rich = new RichTextBox(); this.gridControl1[e.RowIndex,e.ColIndex].Tag = true; rich.Rtf = e.Style.Text; for( int i = 0;i<=rich.TextLength;i++) { rich.SelectionStart = i; Color oldColor = rich.SelectionColor; for( int j= i;j

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.

;