currentcell backcolor
-
Hi, I have a datagrid & a datatable, and when I use the mousemove event, I run into trouble.
private void dgMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { System.Windows.Forms.DataGrid.HitTestInfo hitInfo = dg.HitTest(new Point(e.X, e.Y)); ...
// find out which cell is entereddg.CurrentCell = new DataGridCell(hitInfo.Row,hitInfo.Column); ...
// use tooltip}
The problem starts when I set dg.CurrentCell. Whatever it's set to, the backcolor of that cell changes to what looks like some default color (biege), and the text is highlighted. Also, the MouseUp event doesn't seem to fire, at least not consistently. I've been trying to figure this one out for a while now, and am pretty stuck. :confused: Anyone know what to do? You'd be my hero! Thanks, Mel -
Hi, I have a datagrid & a datatable, and when I use the mousemove event, I run into trouble.
private void dgMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { System.Windows.Forms.DataGrid.HitTestInfo hitInfo = dg.HitTest(new Point(e.X, e.Y)); ...
// find out which cell is entereddg.CurrentCell = new DataGridCell(hitInfo.Row,hitInfo.Column); ...
// use tooltip}
The problem starts when I set dg.CurrentCell. Whatever it's set to, the backcolor of that cell changes to what looks like some default color (biege), and the text is highlighted. Also, the MouseUp event doesn't seem to fire, at least not consistently. I've been trying to figure this one out for a while now, and am pretty stuck. :confused: Anyone know what to do? You'd be my hero! Thanks, MelIt seems you are selecting a cell in the programmatically in the mousemove event by setting the CurrentCell. That is the reason its hightligting the cell with the default color and text is highlighted. Since there is not mouseDown happening here , mouseeUp would not be called. Why do you need to set the CurrentCell in the mousemove anyway? Thanks, VPMahank
-
It seems you are selecting a cell in the programmatically in the mousemove event by setting the CurrentCell. That is the reason its hightligting the cell with the default color and text is highlighted. Since there is not mouseDown happening here , mouseeUp would not be called. Why do you need to set the CurrentCell in the mousemove anyway? Thanks, VPMahank
Hi! I use CurrentCell to get the text in the cell.
private void dgMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { System.Windows.Forms.DataGrid.HitTestInfo hitInfo = dg.HitTest(new Point(e.X, e.Y)); if (hitInfo.Row < tCat.Rows.Count && hitInfo.Row > -1) { dg.CurrentCell = new DataGridCell(hitInfo.Row,hitInfo.Column); DataGridCell dc = dg.CurrentCell; string txt = dg[dc].ToString(); if (txt.Length > 10){
//tooltip stuff} } }
There's one more case where I have this problem of a beige cell background and highlighted text - when I click on a cell (on MouseDown). As soon as the mouse comes back up, it goes back to the colors I want it to be. Is there any way to get rid of this? Thanks so much! Mel