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

How to replace "arrow" of rowheader by another image?

How to replace "arrow" image of rowheader by another image (e.g. hand_image)?

8 Replies

AD Administrator Syncfusion Team January 18, 2005 10:54 AM UTC

One thing you can do is to handle the CellDrawn event, and if it is the current rowheader that has been drawn, then draw your bitmap over it. Here is code that assume the image you want to use is 0th entry in the ImageList, this.imageList1. private void gridDataBoundGrid1_CellDrawn(object sender, GridDrawCellEventArgs e) { if(e.ColIndex == 0 && e.RowIndex == this.gridDataBoundGrid1.CurrentCell.RowIndex) { Rectangle rect = GridUtil.CenterInRect(e.Bounds, this.imageList1.ImageSize); GridStaticCellRenderer.DrawImage(e.Graphics, this.imageList1, 0, rect, false); } }


DB David Bosak January 18, 2005 10:30 PM UTC

However, I see both the arrow image and my image. How to remove the arrow image?


AD Administrator Syncfusion Team January 18, 2005 11:09 PM UTC

You can try adding this to your form.Load. this.gridDataBoundGrid1.BaseStylesMap["Row Header"].StyleInfo.CellType = "Header";


DB David Bosak January 19, 2005 01:16 AM UTC

It worked OK. Thanks,


PT Phuoc Tu January 27, 2005 06:50 AM UTC

Similar this, I use SplitterControl for the grid. When I focus a cell on right grid, the image not changed. I debug and found: e.RowIndex different with this.grid.CurrentCell.RowIndex Can you teach me?


AD Administrator Syncfusion Team January 27, 2005 07:23 AM UTC

If you are using our TabBarSplitterControl or GridRecordNavigationControl (that supports a dynamic splitter), then you must do extra work to make sure all events are properly handled when you add/remove panes in the splitter. This may be why things are not working for you. See this KB that explains how to handle this problem. http://64.78.18.34/Support/article.aspx?id=580


PT Phuoc Tu January 28, 2005 12:15 AM UTC

I tried to use but it still not worked. Please help me. And here is my code. GridDataBoundGrid rightGrid = null; private void splitterControl1_PaneCreated(object sender, Syncfusion.Windows.Forms.SplitterPaneEventArgs e) { rightGrid = e.Control as GridDataBoundGrid; if (rightGrid != null) { rightGrid.CellDrawn += new GridDrawCellEventHandler(rightGrid_CellDrawn); rightGrid.CurrentCellChanged += new EventHandler(rightGrid_CurrentCellChanged); } } private void gridROPStore_CellDrawn(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e) { if(e.ColIndex == 0 && e.RowIndex == this.gridROPStore.CurrentCell.RowIndex && e.RowIndex > 0) { Rectangle rect = GridUtil.CenterInRect(e.Bounds, this.imageList1.ImageSize); GridStaticCellRenderer.DrawImage(e.Graphics, this.imageList1, 0, rect, false); } } private void gridROPStore_CurrentCellChanged(object sender, System.EventArgs e) { int iRow = gridROPStore.CurrentCell.RowIndex, iCol = gridROPStore.CurrentCell.ColIndex; switch(iCol) { case 5: case 7: case 11: case 19: case 21: case 23: case 25: case 27: case 29: case 31: case 33: case 35: case 37: case 39: case 41: case 43: gridROPStore[iRow, iCol+1].CellValue = DateTime.Now; break; } } private void rightGrid_CellDrawn(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e) { if(e.ColIndex == 0 && e.RowIndex == this.rightGrid.CurrentCell.RowIndex && e.RowIndex > 0) { Rectangle rect = GridUtil.CenterInRect(e.Bounds, this.imageList1.ImageSize); GridStaticCellRenderer.DrawImage(e.Graphics, this.imageList1, 0, rect, false); } } private void rightGrid_CurrentCellChanged(object sender, System.EventArgs e) { int iRow = rightGrid.CurrentCell.RowIndex, iCol = rightGrid.CurrentCell.ColIndex; switch(iCol) { case 5: case 7: case 11: case 19: case 21: case 23: case 25: case 27: case 29: case 31: case 33: case 35: case 37: case 39: case 41: case 43: rightGrid[iRow, iCol+1].CellValue = DateTime.Now; break; } } Thanks Phuoc Tu


AD Administrator Syncfusion Team January 28, 2005 06:31 AM UTC

Do not have two CellDrawn and CurrentCellChanged event handlers. Instead have exactly one CellDrawn and one CurrentCellChanged event handlers that are used for any grid. Also, you will not be able to check the currentcell, instead check for the binder.CurrentPosition. Here is a sample with this working in the splitter you see in a GridRecordNavigationControl. http://www.syncfusion.com/forums/Uploads/GRNC_ImageInHeader.zip

Loader.
Live Chat Icon For mobile
Up arrow icon