Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要通过单击行上的任意位置来选择 GridView 行。怎么做?
如果您从工具栏手动添加了网格,您可以将其Selection Mode属性更改为FullRowSelect。如果您以编程方式添加它,您可以使用
Selection Mode
FullRowSelect
Grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect.
Grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect
Grid.Rows[Grid.CurrentRow.Index].Cells["nameofcolumn"].Value.ToString()