如题
在线等用过以下方法,但是不能按照每一列的最大宽度'//自动调整Grid各列列宽为最合适的宽度
Public Sub AdjustColWidth(frmCur As Form, gridCur As Object, Optional bNullRow As Boolean = True, Optional dblIncWidth As Double = 0)
'--------------------------------------------------------------------
'功能:
' 自动调整Grid各列列宽为最合适的宽度
'参数:
' [frmCur].........................................当前工作窗体
' [gridCur]........................................当前要调整的Grid
'--------------------------------------------------------------------
Dim i, j As Integer
Dim dblWidth As DoubleWith gridCur
For i = 0 To .Cols - 1
dblWidth = 0
If .ColWidth(i) <> 0 Then
For j = 0 To .Rows - 1
If frmCur.TextWidth(.TextMatrix(j, i)) > dblWidth Then
dblWidth = frmCur.TextWidth(.TextMatrix(j, i))
End If
Next
.ColWidth(i) = dblWidth + dblIncWidth + 100
End If
Next
End With
在线等用过以下方法,但是不能按照每一列的最大宽度'//自动调整Grid各列列宽为最合适的宽度
Public Sub AdjustColWidth(frmCur As Form, gridCur As Object, Optional bNullRow As Boolean = True, Optional dblIncWidth As Double = 0)
'--------------------------------------------------------------------
'功能:
' 自动调整Grid各列列宽为最合适的宽度
'参数:
' [frmCur].........................................当前工作窗体
' [gridCur]........................................当前要调整的Grid
'--------------------------------------------------------------------
Dim i, j As Integer
Dim dblWidth As DoubleWith gridCur
For i = 0 To .Cols - 1
dblWidth = 0
If .ColWidth(i) <> 0 Then
For j = 0 To .Rows - 1
If frmCur.TextWidth(.TextMatrix(j, i)) > dblWidth Then
dblWidth = frmCur.TextWidth(.TextMatrix(j, i))
End If
Next
.ColWidth(i) = dblWidth + dblIncWidth + 100
End If
Next
End With
解决方案 »
- vb6.0数据库查询 分享
- 注册表的基本操作 就等于是在给你加分的问题!!!
- 关于VB编译后运行退出时报内存不能Written的错误!
- 急!!!请问是否有类似于Microsoft OutLook中的OutLook面板快捷方式的控件供共享!
- 如何获得当前操作系统的系统目录?
- VB大虾有兴趣否,为什么CCC表第7列都是红色的.
- 紧急求助:怎样随机读取大容量文件啊!
- VB的循环中有没有continue语句呢?不能总用if endif 来判断吧?
- 请问在WIN2000下如何让CTL+ALT+DEL发现不了你的程序?急急急!!!
- 小弟问:如何设公用变量?(就是在所有情况下值不会丢的那种?)
- FORM2.0 的ComboBox控件不能加载
- 如何取得外部程序界面中的一个label的caption,并触发外部程序中的一个按钮的点击?
我自己没有调用好,晕