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

Add Current Cell Color

Hi, I would like to find a technic to color currrentCell of my dataGrid which already contains a panel control. I found this tips on the KnowledgeBase: When the currentcell is not in edit mode, it is generally a part of the selections. It is just that the current cell is not included when the selection rectangle is drawn. This is by design. If you want to see it colored like other selected cells, then you can handle the CellDrawn event and color it there. Here is some code snippets in C# and VB.NET. [C#] private void gridDataBoundGrid1_CellDrawn(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; if(e.ColIndex == cc.ColIndex && e.RowIndex == cc.RowIndex) { using(SolidBrush br = new SolidBrush(this.gridDataBoundGrid1.AlphaBlendSelectionColor)) { e.Graphics.FillRectangle(br, e.Bounds); } } } It works perfect with a currentCell without Panel Control. But if the Current Cell contains one Panel Control, it will be colored only after I release the mouse button, not during the Pressure. Can you help me please?

1 Reply

AD Administrator Syncfusion Team April 13, 2005 12:35 AM UTC

I think you can handle this by deriving the panel and overriding its OnPaint method. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GC_PanelCell_1a482356.zip

Loader.
Live Chat Icon For mobile
Up arrow icon