没法直接获取可滚动范围,建议可以模拟把表格滚动到最后一行最后一列,然后再去获取最大的scrollpositon,参考代码
- private void testToolStripMenuItem_Click(object sender, EventArgs e)
- {
- c1FlexGrid1.TopRow = c1FlexGrid1.Rows.Count - 1;
- c1FlexGrid1.LeftCol = c1FlexGrid1.Cols.Count - 1;
- var point = c1FlexGrid1.ScrollPosition;
- hScrollBar1.Minimum = 0;
- hScrollBar1.Maximum = -point.X;
- hScrollBar1.Scroll += HScrollBar1_Scroll;
- c1FlexGrid1.TopRow = 0;
- c1FlexGrid1.LeftCol = 0;
- }
- private void HScrollBar1_Scroll(object sender, ScrollEventArgs e)
- {
- c1FlexGrid1.ScrollPosition = new Point(-hScrollBar1.Value ,c1FlexGrid1.ScrollPosition.Y);
- }
复制代码 |