c# - Datagridview checkbox column has a dead area -
i have datagridview
(winforms) checkbox
column other text-based columns. i've worked through of common issues around checkbox
columns documented on site.
however, have 1 remaining problem. able click "directly" on checkbox
, respond way want. however, if move mouse pointer between cell boundary , checkbox
control, , mouse click, able select cell state of checkbox
not toggle. problem more evident when row height bigger given row.
thanks help
note: not, repeat not, issue occurs when focus moves off given checkbox cell after checked. have 1 solved.
this not issue. how supposed work. grid column can have cellclick events , cellcontentclick events. since want checkbox check when click anywhere inside cell, should use cellclick. among other events need listen for, added following code:
private void grid_cellclick(object sender, datagridviewcelleventargs e) { if ((e.columnindex == 1) && e.rowindex != -1) { this.mygrid[1, e.rowindex].value = !(bool)this.mygrid[1, e.rowindex].value; this.mygrid.endedit(); } }
Comments
Post a Comment