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

Drawing on a CoveredRange

Thread ID:





100408 Aug 4,2011 07:33 PM UTC Aug 9,2011 03:23 PM UTC WinForms 1
Tags: GridControl
Marion Smith
Asked On August 4, 2011 07:33 PM UTC

I read the manual about drawing on a cell (i.e. DrawCell & CellDrawn), but I plan to use the CoveredRange, how will the covered ranged be referenced? Will it be the TopLeft of the cell and then I just use either event to draw in the CoveredRange cell?

Thanks in advance.

Ragamathulla B [Syncfusion]
Replied On August 9, 2011 03:23 PM UTC

Hi Marion,

We regret deeply for the delay.

To achieve the desired behavior in mouse down event, please refer the dashboard sample “Custom Cell Range Demo” .The following code explain the same.

void gridGroupingControl1_TableControlCellDrawn(object sender, GridTableControlDrawCellEventArgs e)
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Inner.Style;
GridTableCellStyleInfoIdentity id = style.TableCellIdentity;

// Employees_Photo column
if (id.Column != null && id.Column.MappingName == Employees_Photo)
Group group = id.DisplayElement.ParentGroup;

// Grouped by Customers_ContactName
if (group != null && group.CategoryColumns.Count > 0 && group.CategoryColumns[0].Name == Customers_ContactName)
if (group.Records.Count > 0)
Record r = group.Records[0];

object value = r.GetValue(id.Column.FieldDescriptor);

// Should be byte[] (image stream ...)
byte[] byteStream = value as byte[];

if (byteStream != null)
Graphics graphics = e.Inner.Graphics;
Image image = GridImageUtil.ConvertToImage(byteStream);
Rectangle bounds = e.Inner.Bounds;
bounds = GridMargins.RemoveMargins(bounds, style.TextMargins.ToMargins());
bounds = GridMargins.RemoveMargins(bounds, style.BorderMargins.ToMargins());
style.ImageSizeMode = GridImageSizeMode.CenterImage;
GridImageUtil.DrawImage(image, bounds, graphics, bounds, style, false);
e.Inner.Cancel = true; // signals you did your own drawing.

The following path contains the sample from the dashboard.

..\..\AppData\Local\Syncfusion\EssentialStudio\{installedVersion}\Windows\Grid.Windows\Samples\2.0\Appearance\Custom Cell Range Demo

Let me know if you have any concern.

Ragamathullah B


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