打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
让msflexgrid控件的宽度自动调整
让msflexgrid控件的宽度自动调整
2010-02-05 09:51
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 Double
          With 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
           
End Sub

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
两个MSFlexGrid的函数 点击表头排序函数以及依据内容自动调整列宽为最合适的宽度
MSHFlexGrid控件自动调整列宽应用
DataGrid、MSFlexGrid和MSHFlexGrid控件的区别
字符表格控件MSFlexGrid
datagrid\mshflexgrid\msflexgrid的区别
VB MSFlexGrid控件的几种简单的使用方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服