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

GridTextBoxCellRenderer::OnDraw and ApplyText

Thread ID:





37911 Dec 2,2005 12:23 AM UTC Dec 3,2005 01:38 AM UTC WinForms 4
Tags: GridControl
Administrator [Syncfusion]
Asked On December 2, 2005 12:23 AM UTC

In GridTextBoxCellRenderer::OnDraw, if I set style.ApplyText("Hello World!"); Will the displaystring in the grid from there on be "Hello World!", irrespective of what the cellvalue or cellvalue''s ToString is(which is what I want)?

Administrator [Syncfusion]
Replied On December 2, 2005 12:54 AM UTC

If you just want to control the text that is displayed in cells, but not affect anything else (like the cell value, etc.), the try handling the grid.DrawCellDisplayText event. There set e.DisplayText to the text you want to see in the cell pointed to by e.Style.CellIdentity.RowIndex and e.Style.CellIdentity.ColIndex.

Administrator [Syncfusion]
Replied On December 2, 2005 11:31 PM UTC

Having lot of problems with grid_DrawCellDisplayText. As you pointed out I am using e.Style.CellIdentity.RowIndex and e.Style.CellIdentity.ColIndex to set the DisplayText. However, whereas in the grid my Column = 4 is using a renderer say "MyRenderer", however in grid_DrawCellDisplayText, column 4 is not "MyRenderer" instead it is something else!!! in grid_DrawCellDisplayText, i have : if(this.GetType() == typeof(MyRenderer)) { Debug.WriteLine(e.Style.CellIdentity.ColIndex); } The colindex being printed out is 12 instead of 4 What gives?

Administrator [Syncfusion]
Replied On December 3, 2005 01:03 AM UTC

OK i used Model_QueryCellFormattedText instead and it seems to be working fine. PLEASE LET ME KNOW IF YOU FORESEE ANY PROBLEMS WITH THIS EVENT.

Administrator [Syncfusion]
Replied On December 3, 2005 01:38 AM UTC

>>if(this.GetType() == typeof(MyRenderer)) DrawCellDisplaytext is raised for every cell. So, since this code is in your renderer class, it will always be true as the ''this'' object is your renderer. It does not vary each time the DrawCellDisplaytext is raised. So, instead of testing this.GetType(), you might try: if(grid.GetCellRenderer(e.Style.CellIdentity.RowIndex, e.Style.CellIdentity.ColIndex) is MyRenderer)


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

This page will automatically be redirected to the 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