争怎路由网:是一个主要分享无线路由器安装设置经验的网站,汇总WiFi常见问题的解决方法。

MSFlexGrid使用技巧一例

时间:2024/6/22作者:未知来源:争怎路由网人气:

本来通过ERP中基础分类档案的每级编码规则控制来展现MSFlexGrid控件的使用技巧,大家只要向控件添加一个MSFlexGridCombo控件就好了,源码如下:

 

Option Explicit

 

Private Sub Combo1_Click()

    MSFlexGrid1.text = Combo1.text

End Sub

 

Private Sub Combo1_KeyPress(KeyAscii As Integer)

If KeyAscii = vbKeyEscape Then

    Combo1.Visible = False

    MSFlexGrid1.SetFocus

    Exit Sub

End If

 

If KeyAscii = vbKeyReturn Then

    MSFlexGrid1.text = Combo1.text

    Combo1.Visible = False

    MSFlexGrid1.SetFocus

End If

End Sub

 

Private Sub Combo1_LostFocus()

    Combo1.Visible = False

    MSFlexGrid1.SetFocus

    Exit Sub

End Sub

 

Private Sub Form_Load()

Dim i As Integer

Dim width, text, Archives

width = Array("400", "2100", "800", "800", "800", "800", "800", "800", "800", "800", "800")

text = Array("序号", "档案名称", "1", "2", "3", "4", "5", "6", "7", "8", "9")

Archives = Array("null", "科目", "项目分类", "固定资产分类", "部门分类", "员工分类", "供应商分类", "客户分类", "销售商分类", "地区分类", "出入库类别", "存货分类", "预留12", "预留13", "预留14", "预留15", "预留16", "预留17", "预留18", "预留19", "预留20")

With MSFlexGrid1

    .Rows = 21

    .Cols = 11

    .FixedCols = 2

    .FixedRows = 1

End With

 

For i = 1 To 9

    Combo1.AddItem i

Next i

 

For i = 0 To 10

    MSFlexGrid1.ColWidth(i) = width(i)

    MSFlexGrid1.TextMatrix(0, i) = text(i)

Next i

 

For i = 1 To 20

    With MSFlexGrid1

    .TextMatrix(i, 0) = i

    .TextMatrix(i, 1) = Archives(i)

    .RowHeight(i) = 300

    End With

Next i

End Sub

 

Private Sub MSFlexGrid1_Click()

Dim c As Integer, r As Integer

With MSFlexGrid1

    c = .col

    r = .row

    If c > 1 And r > 0 Then

        Combo1.Left = .Left + .ColPos(c) + 50

        Combo1.Top = .Top + .RowPos(r) + 50

        Combo1.width = .ColWidth(c)

        Combo1.text = .text

        Combo1.Visible = True

        Combo1.SetFocus

    End If

End With

End Sub

 

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)

If KeyAscii = vbKeyReturn Then

    Call MSFlexGrid1_Click

End If

End Sub




关键词:MSFlexGrid运用技巧一例




Copyright © 2012-2018 争怎路由网(http://www.zhengzen.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版