This one should be easy....
-
Ok.. I'm missing something. I've had a (quick) poke around the MS_Help for the datagrid control. I can't for the life of me get the control to highlight an ENTIRE ROW when ANY field (not column) in a given row is clicked! P.S. Please keep insulting remarks to a minimum. I already know I'm an idiot for having to ask... Mike Stanbrook mstanbrook@yahoo.com
-
Ok.. I'm missing something. I've had a (quick) poke around the MS_Help for the datagrid control. I can't for the life of me get the control to highlight an ENTIRE ROW when ANY field (not column) in a given row is clicked! P.S. Please keep insulting remarks to a minimum. I already know I'm an idiot for having to ask... Mike Stanbrook mstanbrook@yahoo.com
this might work for you.. im not to sure though because i have never used a data grid before. anyways, (from clip board) To determine which part of the control the user clicked, use the HitTest method in the MouseDown event. The HitTest method returns a DataGrid.HitTestInfo object, which contains the row and column of a clicked area. [C#] protected void dataGrid1_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e) { Console.WriteLine(); System.Windows.Forms.DataGrid.HitTestInfo myHitTest; // Use the DataGrid control's HitTest method with the x and y properties. myHitTest = dataGrid1.HitTest(e.X,e.Y); Console.WriteLine(myHitTest); Console.WriteLine("Column " + myHitTest.Column); Console.WriteLine("Row " + myHitTest.Row); Console.WriteLine("Type " + myHitTest.Type); Console.WriteLine("ToString " + myHitTest.ToString()); Console.WriteLine("Hit " + myHitTest.Type.ToString()); } ill keep looking till i find it out for sure though. looking some more.. i think that you will have too manually tell the list box to select the other items on that row. good luck...tell me how it goes. (im curious myself now too).
-
this might work for you.. im not to sure though because i have never used a data grid before. anyways, (from clip board) To determine which part of the control the user clicked, use the HitTest method in the MouseDown event. The HitTest method returns a DataGrid.HitTestInfo object, which contains the row and column of a clicked area. [C#] protected void dataGrid1_MouseDown (object sender, System.Windows.Forms.MouseEventArgs e) { Console.WriteLine(); System.Windows.Forms.DataGrid.HitTestInfo myHitTest; // Use the DataGrid control's HitTest method with the x and y properties. myHitTest = dataGrid1.HitTest(e.X,e.Y); Console.WriteLine(myHitTest); Console.WriteLine("Column " + myHitTest.Column); Console.WriteLine("Row " + myHitTest.Row); Console.WriteLine("Type " + myHitTest.Type); Console.WriteLine("ToString " + myHitTest.ToString()); Console.WriteLine("Hit " + myHitTest.Type.ToString()); } ill keep looking till i find it out for sure though. looking some more.. i think that you will have too manually tell the list box to select the other items on that row. good luck...tell me how it goes. (im curious myself now too).
This is what I got to work:
this.searchResults.MouseUp += new System.Windows.Forms.MouseEventHandler(this.searchResults_MouseUp);
private void searchResults_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Windows.Forms.DataGrid.HitTestInfo hti = this.searchResults.HitTest(e.X,e.Y);
if (hti.Row >=0){
searchResults.CurrentCell = new DataGridCell(hti.Row, hti.Column);
searchResults.Select(hti.Row);
}
}Now, catching the double click, that is another story all together!! Note: Here is an EXCELLENT site with tons of WinForms tidbits: http://www.syncfusion.com/FAQ/WinForms/default.asp[^] Mike Stanbrook mstanbrook@yahoo.com