Wrox Home  
Search P2P Archive for: Go

  Return to Index  

ado_dotnet thread: MouseOver issue in a DataGrid


Message #1 by "Kruse Ludington" <ceo@K...> on Fri, 23 Nov 2001 05:17:10 -0500
I am trying to use the MouseHover event to change the background on a row in

the grid temporarily (only while the mouse floats over that row). Does

anybody have any code examples ? Also, these are the problems I have run

into so far:



1. The mousehover event has to be declared with System.EventArgs, rather

than the MouseEventArgs, therefore the mouse position is not passed as an

argument. Unfortunately, the mouse position can be grabbed from the object

passed in the event but those coordinates must be translated to the

coordinates on the grid to determnine which row to use. What is the

translation function for this ? A direct mathematical attempt using the

screen size, window and datagrid positions ends up with an incorrect

calculation when you are trying to hover the mouse over the last row

displayed in the grid. So there must be some sort of more accurate

conversion function ?



2. What is the best comnmand to use to change the background of an entire

row without using up to much CPU power (ie., not changing the background

properties of every cell in a row) but also not using the .Select method (I

want to differentiate with different colors for rows selected as opposed to

a row that is are being hovered over.)



- Please also reply to kruse.ludington@c... on this, thanks.



- Kruse






  Return to Index