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. DataGrid - Click anywhere and act like you clicked to the far left.

DataGrid - Click anywhere and act like you clicked to the far left.

Scheduled Pinned Locked Moved C#
questiontutorial
2 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
    mikemilano
    wrote on last edited by
    #1

    Is there any way to click somewhere in the datagrid, but have it highlight the entire row like it would if you clicked the row on the far left outside all the cells? I can get it to highlight the entire row, but it also highlights the text inside the cell i clicked on. I guess I'm answering my own question in a way. Now I need to find out how to make the cell text not highlight. =)

    A 1 Reply Last reply
    0
    • M mikemilano

      Is there any way to click somewhere in the datagrid, but have it highlight the entire row like it would if you clicked the row on the far left outside all the cells? I can get it to highlight the entire row, but it also highlights the text inside the cell i clicked on. I guess I'm answering my own question in a way. Now I need to find out how to make the cell text not highlight. =)

      A Offline
      A Offline
      A Wegierski
      wrote on last edited by
      #2

      Override OnMouseDown etc. protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); //selecting row this.Select(this.CurrentRowIndex); //hilighting the cell DataGrid.HitTestInfo hi=this.HitTest(e.X,e.Y); if(e.Button==MouseButtons.Left && hi.Type==DataGrid.HitTestType.Cell && hi.Row>=0) { ... } } Hi, AW

      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