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

Grid redrawing messing up.... Plz help Clay!!

Here is the project, please open it and try this : Select a cell (with text) and click on another cell. Go back to the previous cell and move again. The last active subcell should now follow you anywhere you go... WTF??? How can I fix this????? Grid-Broken_2602.zip

2 Replies

MC Martin Cyr July 14, 2005 04:19 PM UTC

Fixed it!! This is one of the most incidious bugs I ever seen, I personnaly spent 3 days on it, my boss about half a day. I believe the blame would be on your codebase. The usercontrol.visible gets set to true when drawn, it seems, but never turned back to visible=false. I simply added on the parent grid, in the CurrentCellMoving, usercontrol.visible=false... magic! Please check the codebase if there wouldn''t be something that could be fixed to avoid such events in the future.

AD Administrator Syncfusion Team July 14, 2005 10:51 PM UTC

Below is a version of OnDraw that I think also handles this problem without using the CurrentCellMoving event. In GridGenericCellRenderer.OnDraw, if the style.Control is hidden, it properly positions it and makes it visible. If it is already visible, then the base class assumes it does not need to be positioned. Protected Overrides Sub OnDraw(ByVal g As System.Drawing.Graphics, ByVal clientRectangle As System.Drawing.Rectangle, ByVal rowIndex As Integer, ByVal colIndex As Integer, ByVal style As Syncfusion.Windows.Forms.Grid.GridStyleInfo) clientRectangle.Inflate(-1, -1) style.Control = Nothing If Not Me.ShouldDrawFocused(rowIndex, colIndex) Then staticGridInCell.Tag = New Point(colIndex, rowIndex) staticGridInCell.Refresh() style.Control = staticGridInCell Else activeGridInCell.Tag = New Point(colIndex, rowIndex) activeGridInCell.Refresh() style.Control = activeGridInCell Dim planifGridUC As PlanificationGridUC = Grid.Parent planifGridUC.ActiveUserControl.Hide() End If MyBase.OnDraw(g, clientRectangle, rowIndex, colIndex, style) End Sub ''OnDraw

Live Chat Icon For mobile
Up arrow icon