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. Image for the cookie policy date

icon selection

Hello,

I have a little problem: when I select one row (on the first cell, something identic like drag&drop) in a unbound grid and move this selection into another grid, I want to change the selection icon (the arrow icon) into another icon - like drag&drop.

Could you please help me in this situation ?

Regards !

3 Replies

AD Administrator Syncfusion Team December 14, 2006 05:07 AM UTC

Hi Venatir,

Try setting the CellType of the RowHeader cell to "Header" and handle the DrawCell event to draw the image on the cell in a Grid. Here is a code snippet to show this.

this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header";
this.gridDataBoundGrid1.DrawCell +=new GridDrawCellEventHandler(gridDataBoundGrid1_DrawCell);

private void gridDataBoundGrid1_DrawCell(object sender, GridDrawCellEventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
GridCurrentCell cc = grid.CurrentCell;
if( e.RowIndex == cc.RowIndex && e.ColIndex == 0 )
{
e.Renderer.Draw(e.Graphics,e.Bounds,e.RowIndex,e.ColIndex,e.Style);
e.Graphics.DrawImage(SystemIcons.Exclamation.ToBitmap(),e.Bounds);
e.Cancel = true;
}
}

Please refer to the attached sample for implementation.
GDBGRowHeaderIcon.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team December 14, 2006 01:25 PM UTC

Hello Haneef,

Thanks a lot for your help but my problem is a little different. Your example works properly but I don't want to set the first row cell. When I select a row on first cell and I want to move this selection (like drag&drop case) I want the cursor change from black arrow in another icon black circle, strikethrough).

Regards !



>Hi Venatir,

Try setting the CellType of the RowHeader cell to "Header" and handle the DrawCell event to draw the image on the cell in a Grid. Here is a code snippet to show this.

this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header";
this.gridDataBoundGrid1.DrawCell +=new GridDrawCellEventHandler(gridDataBoundGrid1_DrawCell);

private void gridDataBoundGrid1_DrawCell(object sender, GridDrawCellEventArgs e)
{
GridDataBoundGrid grid = sender as GridDataBoundGrid;
GridCurrentCell cc = grid.CurrentCell;
if( e.RowIndex == cc.RowIndex && e.ColIndex == 0 )
{
e.Renderer.Draw(e.Graphics,e.Bounds,e.RowIndex,e.ColIndex,e.Style);
e.Graphics.DrawImage(SystemIcons.Exclamation.ToBitmap(),e.Bounds);
e.Cancel = true;
}
}

Please refer to the attached sample for implementation.
GDBGRowHeaderIcon.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team December 15, 2006 11:57 AM UTC

Hi Venatir,

You can change the mouse cursor for the grid through three methods. They are explained with an example in the following KB article.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=69

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon