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.

Turn off CellButton hover-color

Thread ID:





72640 Mar 29,2008 11:23 AM Mar 31,2008 07:17 PM Windows Forms 1
Tags: GridControl
Asked On March 29, 2008 11:23 AM

I have a GridControl which embeds CellButtons like one of the demo apps.

But I want the button to remain the same color, and only change when its pressed.

At the moment the button changes color when the mouse hovers over it, which doesnt look nice.

Id like to still use themes, but if this isnt possible Id rather just render the button myself


Administrator [Syncfusion]
Replied On March 31, 2008 07:17 PM


Thank you for your interest in Syncfusion products.

You need to override Draw method of GridCellButton class and set the hovering to false to prevent drawing of the cell button when hovering the cell. Please refer the code below for more details.

public override void Draw(Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style)
TraceUtil.TraceCurrentMethodInfo(rowIndex, colIndex, bActive, style.CellValue);
base.Draw(g, rowIndex, colIndex, bActive, style);
bool hovering = false;/// IsHovering(rowIndex, colIndex);
bool mouseDown = IsMouseDown(rowIndex, colIndex);
bool disabled = !style.Clickable;
ButtonState buttonState = ButtonState.Normal;
if (disabled)
buttonState |= ButtonState.Inactive | ButtonState.Flat;
else if (!hovering && !mouseDown)
buttonState |= ButtonState.Flat;
Point ptOffset = Point.Empty;
if (mouseDown)
ptOffset = new Point(1, 1);
buttonState |= ButtonState.Pushed;
DrawButton(g, Bounds, buttonState, style);
string bitmapName = "Browse.bmp"; // make sure this is included in project and marked as "Embedded Resource"
iconPainter.PaintIcon(g, Bounds, ptOffset, bitmapName, Color.Blue);

Here is the minimal sample that implement this task.

Please let me know if this helps.

Best Regards,


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.