Firstly, is holding control by default the only way the user can
select multiple rows that aren't adjacent to each other like this?
No, you can have it by your own way by implemeting Events
. These links may help you achieve what you want: this and this.
Secondly, how would one disable this behavior?
Disable the ctrl+click so that the user cannot select multiple cells, rows or columns that are apart from each other. You can do this by overriding the OnMouseDown
event. Obviously for this you will have to go for your own (datagridview inherited) control. In that override the OnMouseDown
event by..
protected override void OnMouseDown(MouseEventArgs e)
{
if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
{
}
else
{
base.OnMouseDown(e);
}
}
Hope it helps.