MSFlexGrid控件
在别人的程序上做修改,下面程序不懂涵义,还请大家不吝赐教!!代码如下:PublicSubcfg()DimCfgloadAsCfgdata//此处定义为什么意思??Dimi...
在别人的程序上做修改,下面程序不懂涵义,还请大家不吝赐教!!
代码如下:
Public Sub cfg()
Dim Cfgload As Cfgdata //此处定义为什么意思??
Dim i As Integer
Dim fnum As Integer
Dim temp As Integer
fnum = 1
Open App.Path & "\testcfg.txt" For Random As #fnum Len = Len(Cfgload) //??
temp = LOF(fnum) / Len(Cfgload) //??
//下面语句可否挑一个case解释一下?
For i = 1 To temp
Select Case i
Case Is < 9
With MainFrm.MSFlexGrid1
Get #1, i, Cfgload
.TextMatrix(i, 0) = Trim(Cfgload.Name)
Range_L1(i - 1) = Cfgload.Low
Range_H1(i - 1) = Cfgload.High
Span_L(i - 1) = Cfgload.LAlarm
Span_H(i - 1) = Cfgload.HAlarm
RowName(i - 1) = .TextMatrix(i, 0)
End With
Case Is < 17
With MainFrm.MSFlexGrid1
Get #1, i, Cfgload
.TextMatrix(i, 0) = Trim(Cfgload.Name)
Range_L2(i - 9) = Cfgload.Low
Range_H2(i - 9) = Cfgload.High
Span_L(i - 1) = Cfgload.LAlarm
Span_H(i - 1) = Cfgload.HAlarm
RowName(i - 1) = .TextMatrix(i, 0)
End With
End Select
Next i
Close #fnum
End Sub
Cfgdata定义是这样的,还请不吝赐教!
Public Type Cfgdata
ID As Integer
Name As String * 10
Low As Integer
High As Integer
LAlarm As Integer
HAlarm As Integer
End Type 展开
代码如下:
Public Sub cfg()
Dim Cfgload As Cfgdata //此处定义为什么意思??
Dim i As Integer
Dim fnum As Integer
Dim temp As Integer
fnum = 1
Open App.Path & "\testcfg.txt" For Random As #fnum Len = Len(Cfgload) //??
temp = LOF(fnum) / Len(Cfgload) //??
//下面语句可否挑一个case解释一下?
For i = 1 To temp
Select Case i
Case Is < 9
With MainFrm.MSFlexGrid1
Get #1, i, Cfgload
.TextMatrix(i, 0) = Trim(Cfgload.Name)
Range_L1(i - 1) = Cfgload.Low
Range_H1(i - 1) = Cfgload.High
Span_L(i - 1) = Cfgload.LAlarm
Span_H(i - 1) = Cfgload.HAlarm
RowName(i - 1) = .TextMatrix(i, 0)
End With
Case Is < 17
With MainFrm.MSFlexGrid1
Get #1, i, Cfgload
.TextMatrix(i, 0) = Trim(Cfgload.Name)
Range_L2(i - 9) = Cfgload.Low
Range_H2(i - 9) = Cfgload.High
Span_L(i - 1) = Cfgload.LAlarm
Span_H(i - 1) = Cfgload.HAlarm
RowName(i - 1) = .TextMatrix(i, 0)
End With
End Select
Next i
Close #fnum
End Sub
Cfgdata定义是这样的,还请不吝赐教!
Public Type Cfgdata
ID As Integer
Name As String * 10
Low As Integer
High As Integer
LAlarm As Integer
HAlarm As Integer
End Type 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询