Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. This one should be easy....

This one should be easy....

Scheduled Pinned Locked Moved C#
com
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MStanbrook
    wrote on last edited by
    #1

    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

    J 1 Reply Last reply
    0
    • M MStanbrook

      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

      J Offline
      J Offline
      jtmtv18
      wrote on last edited by
      #2

      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).

      M 1 Reply Last reply
      0
      • J jtmtv18

        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).

        M Offline
        M Offline
        MStanbrook
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups