RC
Rajadurai C
Syncfusion Team
November 19, 2008 02:46 PM UTC
Hi Wim,
Thanks for your interest in Syncfusion products.
To add an image over the pushbutton,
1)you need to create your own control by deriving GridPushButtonCellModel and GridPushButtonCellRenderer
2)Add an overridden method in class derived from GridCellButton and add this button cell to the CellModel of gridgroupingcontrol.
The overridden method is given below:
public override void Draw(Graphics g, int rowIndex, int colIndex, bool bActive, GridStyleInfo style)
{
base.Draw(g, rowIndex, colIndex, bActive, style);
// draw the button
bool hovering = 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);
}
This draws a bitmap over the button.
If you have dashboard please refer the browser sample in the following location.
\\Windows\\Grid.Windows\Samples\2.0\CustomCellTypes\CellButtons
that does the same.
Regards,
Rajadurai