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

Custom Cell Drawing

Thread ID:

Created:

Updated:

Platform:

Replies:

69092 Oct 13,2007 06:21 AM UTC Oct 17,2007 12:12 AM UTC WinForms 2
loading
Tags: GridControl
Nick
Asked On October 13, 2007 06:21 AM UTC

Hi,

I have written a user control that embeds within it a sync fusion grid. I am trying to use the grid in virtual mode, and the model for the data is in a custom object model - I am not using te model on the gridcontrol itself.

Te problem I have is I need to get involved in how a cell is drawn. Depending on certain conditions, I might want to draw two pieces of text in a single cell, one with a different background to the other piece of text. I was hoping I could override DrawCell, but I'm not sure how to go about that now. I'm also wondering if it would be simpler to create a CustomCell instead?

Any advice on the *simplest* way of achieving what I want would be most appreciated.

Thanks,

Nick.

Nick
Replied On October 14, 2007 01:18 PM UTC

Hi,

I am drawing text very simply by first painting the background and then painting the text on OnDrawCell:

e.Graphics.DrawString(value, font, new SolidBrush(value.Style.TextColor), e.Bounds);

The problem I now have is that the borders on the cells are showing. If I let the grid draw itself, handling only QueryCellInfo, I can switch off the border to each cell using the following:

style.Borders.All = GridBorder.Empty;
style.CellAppearance = GridCellAppearance.Flat;

Where style is a reference to the TableStyle on my grid.

Any advice on how to deal with the borders?

Thanks,

Nick.

haneefm [Syncfusion]
Replied On October 17, 2007 12:12 AM UTC

Hi Nick,

Please try setting the Borders property in a PrepareViewStyleInfo event.Below are the codes:

e.Style.Borders.All = GridBorder.Empty;

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.

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

;