//sur le mouseup private void dg_Liste_MouseUp(object sender, MouseEventArgs e) { //Lors d'un clique sélectionne la ligne entière Point pt = new Point(e.X, e.Y); DataGrid.HitTestInfo hti = this.HitTest(pt); if(hti.Type == DataGrid.HitTestType.Cell) { this.CurrentCell = new DataGridCell(hti.Row, hti.Column); this.Select(hti.Row); } } //sur le scroll private void dg_Liste_Scroll(object sender, EventArgs e) { try { this.Select(this.CurrentRowIndex); } catch (Exception ex) { } } //et faire un override sur la methode ProcessCmdKey protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { int ligne_crt; try { switch (keyData) { case Keys.Enter : { this.Select(this.CurrentRowIndex); if (this.KeyPressEnter!=null) { this.KeyPressEnter(new object()); } return true; } case Keys.Up : { //....... } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question