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.

Grid DrawEvent, have drawing and cellValue show in the Grid at the same time

Thread ID:

Created:

Updated:

Platform:

Replies:

104760 Aug 15,2012 02:26 PM Aug 17,2012 07:06 AM Windows Forms 3
loading
Tags: GridControl
Jiali Gao
Asked On August 15, 2012 02:26 PM

Hi,

I'm trying to draw a maker in the cell, by using the GridDrawCellEvent.  Also, I use e.cancel = true to keep the marker in the cell all time.  At the same time, I put a text string in the same cell by using QueryCellInfo event. But the text doesn't show.

So, If I have

private void gridControl_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
        {
              e.Style.CellValue="a text message";
        }

private void gridControl_DrawCell(object sender, GridDrawCellEventArgs e)
        {
              e.Graphics.FillPolygon(blueBrush, curvePoints, newFillMode);
        }

then, the text string is showing, but the drawing is not stable.  When the mouse hovers over the cell, the drawing is gone (or mouseClick);

if I have

private void gridControl_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
        {
              e.Style.CellValue="a text message";
        }

private void gridControl_DrawCell(object sender, GridDrawCellEventArgs e)
        {
              e.Graphics.FillPolygon(blueBrush, curvePoints, newFillMode);
              e.Cancel = true;
        }

then, the drawing is stable, but the CellValue does not show.

Is there a way to fix the drawing and also be able to show the CellValue ?

Thank you for your help!!
Jiali

Kalaiarasan B [Syncfusion]
Replied On August 16, 2012 06:14 AM

Hi Jiali

Please try both the actions in a the DrawCell event. Use the Graphics.DrawString to write the cell value in the cell along with the cellvalue.

 void gridControl1_DrawCell(object sender, GridDrawCellEventArgs e)
        {
            e.Graphics.DrawString(arguments)
        }

Please let me know if you have any concerns

Regards,
Kalai

Administrator [Syncfusion]
Replied On August 16, 2012 09:57 AM

Hi Kalaiarasan,

DrawString can draw out the text, but its a good solution for my case.  Is there a way to fix the drawing in the cell, and also be able to set cell value through e.style.cellValue?

Thank you for your help
Jiali

Kalaiarasan B [Syncfusion]
Replied On August 17, 2012 07:06 AM

Hi Jiali,

While handling the drawing and Cellvalue separately in cell, the querycellinfo event will be triggered lastly after DrawCell, so it makes only either of it exists. So you can try both the changes in QueryCellinfo event, by drawing both image and text in a cell.

 Check with this sample : http://www.syncfusion.com/downloads/Support/DirectTrac/89251/ImageCellandText1846318368.zip

Please let me know if this helps

Regards,

Kalai


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.

;