VB6学习技巧


2015-10-26

自动适应MSHFlexGrid1单元格子的大小


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


2015-10-09

在窗体的load函数中,是不可以使用print命令直接在窗体上打印字符的,可在下个过程函数,如点击窗体等里打印。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值