刚才测试了下,如果我想等分6等份,用下面的方法不对,超出了总宽度,鼠标放在最后一列左键点住向右拉动,可以看到右边还是有一点单元格没有显示出来。而如果等分了6份的话向右拖动是拖不动的。
Dim i As Integer
Dim width As Long, height As Long
fpSpread1.MaxCols = 6
fpSpread1.MaxRows = 10
fpSpread1.GetClientArea width, height
For i = 1 To 6
fpSpread1.ColWidth(i) = (width - fpSpread1.ColWidth(0) - fpSpread1.ScrollBarWidth) / 6
Next
我感觉是/6的时候出现了小数导致的
获取滚动条宽度ScrollBarWidth =-1,没有办法根据滚动条进行设置
而且我用下面的方法,将最后一列的宽度改为总宽度-前5列宽度,也不对。
Dim i As Integer
Dim width As Long, height As Long
fpSpread1.MaxCols = 6
fpSpread1.MaxRows = 10
fpSpread1.GetClientArea width, height
For i = 1 To 5
fpSpread1.ColWidth(i) = (width - fpSpread1.ColWidth(0) - fpSpread1.ScrollBarWidth) / 6 - 300
Next
fpSpread1.ColWidth(6) = (width - fpSpread1.ColWidth(0) - fpSpread1.ColWidth(1) - fpSpread1.ColWidth(2) - fpSpread1.ColWidth(3) - fpSpread1.ColWidth(4) - fpSpread1.ColWidth(5) - fpSpread1.ScrollBarWidth)
还请测试一下,谢谢! |