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

Outlining the row which the mouse is over

I am using the CellMouseHoverEnter event to keep track of the mouse and the PrepareVeiwStyleInfo event to draw the border. One problem the event does not repaint the cells. It will only do that if it is the current row. Here is the code im using inside the PrepareVeiwStyleInfo event if (this._currentRowMouseOver == e.RowIndex) { e.Style.Borders.Top = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); if (e.ColIndex == 1) e.Style.Borders.Left = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); } P.S. How can i draw a border on the right edge and is there a better way to do this? TIA, Peter

1 Reply

AD Administrator Syncfusion Team September 29, 2003 05:40 PM UTC

> I am using the CellMouseHoverEnter event to keep track of the mouse and the PrepareVeiwStyleInfo event to draw the border. One problem the event does not repaint the cells. It will only do that if it is the current row. > > Here is the code im using inside the PrepareVeiwStyleInfo event > > if (this._currentRowMouseOver == e.RowIndex) > { > e.Style.Borders.Top = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); > e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); > > if (e.ColIndex == 1) > e.Style.Borders.Left = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); > } > > P.S. How can i draw a border on the right edge and is there a better way to do this? > > TIA, > > Peter In CellMouseHoverEnter you could save the RowIndex that the mouse is hovering over in a variable and only when rowIndex for the event is different from the previously saved then you call InvalidateRange or RefreshRange so that the row gets repainted. To draw the border on the right edge that should work: if (e.ColIndex == ColCount) e.Style.Borders.Right = new GridBorder(GridBorderStyle.Solid, ColorScheme.Rows.MouseOverBorder); You should also handle the Control.MouseLeave event. The way you implment this behavior with MouseHoverXXX and PrepareViewStyleInfo is reasonable. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon