一个关于资料排版的问题
这是资料从结构体经处理转存结果到暂存阵列中的一段代码:
程序代码:
Public Function ToArray(FlowCount As Integer, SubTestCount As Integer, PinNum As Integer, PinName As String, PinMin As String, PinMax As String, PinMeas As String, PinUnit As String, SiteCount As Integer, TestItemType As String) As Boolean
Dim AA As Integer, BB As Integer, CC As Integer, DD As Integer, EE As Integer
Dim FB As String, FC As String, FD As String
On Error GoTo ErrorHandling
AA = Len(PinName)
If Val(PinMin) <> 0 Then
FB = Format(PinMin, "000.0000"): BB = Len(CStr(FB))
Else
BB = Len(PinMin)
End If
If Val(PinMax) <> 0 Then
FC = Format(PinMax, "000.0000"): CC = Len(CStr(FC))
Else
CC = Len(PinMax)
End If
If Val(PinMeas) <> 0 Then
FD = Format(PinMeas, "000.0000"): DD = Len(CStr(FD))
Else
DD = Len(PinMeas)
End If
EE = Len(PinUnit)
OutPutData(SiteCount, OutPutDataCount) = Format(FlowCount, "000") & "." & _
Format(SubTestCount, "00") & "." & _
Format(PinNum, "00") & Space(5) & _
PinName & Space(20 - AA) & _
PinMin & Space(20 - BB) & _
PinMax & Space(20 - CC) & _
PinMeas & Space(20 - DD) & _
PinUnit & Space(10 - EE) & _
Format(SiteCount, "00") & Space(5) & _
TestItemType
'.Site(SiteCount).Pin(.Site(SiteCount).PinNum).PinResult
MyDoEvents
Exit Function
ErrorHandling:
If LogCount > UBound(LogFileNameArray) Then LogCount = UBound(LogFileNameArray)
Call ErrorWriteBuff(LogFileNameArray(LogCount), lines, "ItemProcess", Err.Number, Err.Description, "系统讯息")
Resume Next
End Function
想问问VB依班都是怎做排版的工作?怎排都不整齐一测之下才发现~VB中英文大写和小写和数字虽然都是一个字~但是宽度完全不一样~资料一Output后全都乱掉~
这样一整排下来怎做定位~英文大小写和数字每个字宽都不一样~那要怎搞?
以下是示例: TextBox
程序代码:
Option Explicit
Private Sub Form_Load()
Dim a As String * 20, b As String * 20, c As String * 20, d As String * 20, e As String * 20
Dim aa As String * 20, bb As String * 20, cc As String * 20, dd As String * 20, ee As String * 20
a = "AAAAA": b = "bbbb": c = "cccccccc": d = "A": e = "AAAAAAAAA"
aa = "11111": bb = "4444": cc = "30000002": dd = "1": ee = "13AAddsd2"
Text1.Text = a & b & c & d & e & vbCrLf _
& aa & bb & cc & dd & ee & vbCrLf
a = "Aa12D": b = "ADFb": c = "ccA12ccc": d = "A": e = "AA1"
aa = "11sdf": bb = "444d": cc = "300asd00": dd = "1": ee = "13AA"
Text1.Text = Text1.Text & a & b & c & d & e & vbCrLf _
& aa & bb & cc & dd & ee
End Sub







