Using one scroll bar to control two DataGridView

前端 未结 3 1819
天命终不由人
天命终不由人 2021-01-26 02:39

I am trying to control two DataGridView\'s with only one of the DataGridView vertical scroll bars being visible.

3条回答
  •  鱼传尺愫
    2021-01-26 03:16

    In Form.Load():

    Grid1.Scroll += (s, ev) => Grid2.VerticalScrollBar.Value = Grid1.VerticalScrollBar.Value;
    

    Edit: We can't assign Grid2.VerticalScrollingOffset as I had originally suggested, as it's a ReadOnly property.

提交回复
热议问题