📄 mdrawgraphic.bas
字号:
pic.CurrentY = curY
pic.Print strTemp
strTemp = Format(TempDmyData.JPressMax * i / 5, "0.00")
pic.CurrentX = curx - pic.TextWidth(strTemp)
pic.CurrentY = curY - curHeight / 5 * i - pic.TextHeight(strTemp) / 2
pic.Print strTemp
Next
bx = curWidth / TempDmyData.TimeMax 'x轴比例
by = curHeight / TempDmyData.JPressMax '液面比例
'绘线
pic.DrawStyle = 0
pic.DrawWidth = 2
For i = 2 To UBound(TempDmyData.dmyYT)
x1 = curx + TempDmyData.dmyYT(i - 1, 1) * bx
x2 = curx + TempDmyData.dmyYT(i, 1) * bx
y1 = curY - TempDmyData.dmyYT(i - 1, 5) * by
y2 = curY - TempDmyData.dmyYT(i, 5) * by
pic.Line (x1, y1)-(x2, y2), YmColor
Next
strTemp = "T(hr)"
pic.CurrentX = curx + curWidth - pic.TextWidth(strTemp)
pic.CurrentY = curY + pic.TextHeight(strTemp) * 1.5
pic.Print strTemp
strTemp = "P(MPa)"
pic.CurrentX = curx - pic.TextWidth(strTemp) / 2
pic.CurrentY = curY - curHeight - pic.TextHeight(strTemp) * 1.5
pic.Print strTemp
pic.DrawStyle = 0
pic.DrawWidth = 1
End Function
'画报表
Function drawReport(pic As Object)
'**********************************************************************
'* 函数名称: drawReport
'* 函数描述: 数据报表
'* 参数列表: pic画图控件
'* 作 者:
'* 创建日期: 2007-10-08
'**********************************************************************
Dim i As Integer, j As Integer
Dim strTemp As String
Dim oldFont As Long
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single '绘图区域
Dim colWidth As Single, rowHeight As Single
'----------
setHead
'-------------
curx = pic.Width * 0.05
curY = pic.Height * 0.9
curWidth = pic.Width * 0.9
curHeight = pic.Height * 0.8
'------------------------------
colWidth = curWidth / 8 '列宽
rowHeight = curHeight / 13 '行高
'------------------------------------
strTemp = RepTitle
oldFont = pic.FontSize
pic.FontSize = 12
pic.FontBold = True
pic.CurrentX = curx + (curWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight - pic.TextHeight(strTemp) * 1.5
pic.Print strTemp
pic.FontBold = False
pic.FontSize = oldFont
strTemp = "编 码:" & TempDmyData.dmyRep(1)
pic.CurrentX = curx
pic.CurrentY = curY - curHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "自 编 号:" & TempDmyData.dmyRep(1)
pic.CurrentX = curx + curWidth - pic.TextWidth(strTemp)
pic.CurrentY = curY - curHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'//////画横线
For i = 1 To 12
Select Case i
Case 3
pic.Line (curx + colWidth * 3, curY - curHeight + rowHeight * i)-(curx + colWidth * 5, curY - curHeight + rowHeight * i)
Case Else
pic.Line (curx, curY - curHeight + rowHeight * i)-(curx + curWidth, curY - curHeight + rowHeight * i)
End Select
Next
''///////画竖线
For i = 0 To 8
Select Case i
Case 0, 8
pic.Line (curx + colWidth * i, curY - rowHeight * 12)-(curx + colWidth * i, curY - rowHeight)
Case 4
pic.Line (curx + colWidth * i, curY - rowHeight * 11)-(curx + colWidth * i, curY - rowHeight * 3)
Case 6, 7
pic.Line (curx + colWidth * i, curY - rowHeight * 5)-(curx + colWidth * i, curY - rowHeight * 3)
Case Else
pic.Line (curx + colWidth * i, curY - rowHeight * 12)-(curx + colWidth * i, curY - rowHeight * 3)
End Select
Next
'///////画斜线
pic.Line (curx + colWidth * 3, curY - curHeight + rowHeight * 4)-(curx + colWidth * 4, curY - curHeight + rowHeight * 3)
pic.Line (curx + colWidth * 6, curY - curHeight + rowHeight * 10)-(curx + colWidth * 7, curY - curHeight + rowHeight * 9)
'///第一行
For i = 1 To 5
Select Case i
Case 4
pic.CurrentX = curx + colWidth * 3 + (colWidth * 2 - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(repHead(i))) / 2
Case 5
pic.CurrentX = curx + colWidth * 5 + (colWidth * 3 - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(repHead(i))) / 2
Case Else
pic.CurrentX = curx + colWidth * (i - 1) + (colWidth - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(repHead(i))) / 2
End Select
pic.Print repHead(i)
Next
''/////////第二行标题
For i = 6 To 7
pic.CurrentX = curx + colWidth * (i - 3) + (colWidth - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight * 2 + (rowHeight - pic.TextHeight(repHead(i))) / 2
pic.Print repHead(i)
Next
'For i = 8 To 9
' pic.CurrentX = curX + ColWidth * 5 + (ColWidth * 3 - pic.TextWidth(repHead(i))) / 2
' pic.CurrentY = curY - curHeight + RowHeight * (i - 7) + (RowHeight - pic.TextHeight(repHead(i))) / 2
' pic.Print repHead(i)
'Next
''/////////第二段
For i = 10 To 15
If i = 15 Then
pic.CurrentX = curx + colWidth * (i - 10) + (colWidth * 3 - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(repHead(i))) / 2
pic.Print repHead(i)
Else
pic.CurrentX = curx + colWidth * (i - 10) + (colWidth - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(repHead(i))) / 2
pic.Print repHead(i)
End If
Next
''/////////第三段
For i = 16 To 18
pic.CurrentX = curx + (colWidth - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight * (i - 11) + (rowHeight - pic.TextHeight(repHead(i))) / 2
pic.Print repHead(i)
Next
''/////////第四段
For i = 19 To 26
pic.CurrentX = curx + colWidth * (i - 19) + (colWidth - pic.TextWidth(repHead(i))) / 2
pic.CurrentY = curY - curHeight + rowHeight * 8 + (rowHeight - pic.TextHeight(repHead(i))) / 2
pic.Print repHead(i)
Next
''////////最后标题
pic.CurrentX = curx + (colWidth - pic.TextWidth(repHead(27))) / 2
pic.CurrentY = curY - curHeight + rowHeight * 10 + (rowHeight - pic.TextHeight(repHead(27))) / 2
pic.Print repHead(27)
For i = 1 To 10 Step 2 '写标题
strTemp = repHead((i + 1) / 2 + 27)
pic.CurrentX = curx + (curWidth / 10) * (i - 1) + (curWidth / 10 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 11 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
Next
pic.CurrentX = curx + (colWidth * 2 - pic.TextWidth(repHead(33))) / 2
pic.CurrentY = curY - curHeight + rowHeight * 12 + (rowHeight - pic.TextHeight(repHead(33))) / 2
pic.Print repHead(33)
pic.CurrentX = curx + curWidth - colWidth * 2
pic.CurrentY = curY - curHeight + rowHeight * 12 + (rowHeight - pic.TextHeight(repHead(34))) / 2
pic.Print repHead(34)
'/////////写第一行数据
For i = 1 To 6
strTemp = TempDmyData.dmyRep(i + 2)
Select Case i
Case 4
pic.CurrentX = curx + colWidth * 4 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 3 + (rowHeight - pic.TextHeight(strTemp)) / 2
Case 5
pic.CurrentX = curx + colWidth * 5 + (colWidth * 3 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 2 + (rowHeight * 2 - pic.TextHeight(strTemp)) / 2
Case Else
pic.CurrentX = curx + colWidth * (i - 1) + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 2 + (rowHeight * 2 - pic.TextHeight(strTemp)) / 2
End Select
pic.Print strTemp
Next
''/////////写第三数据
For i = 1 To 5
For j = 0 To 2
strTemp = TempDmyData.dmyRep(5 * j + i + 8)
If i = 5 Then
pic.CurrentX = curx + colWidth * i + (colWidth * 3 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * (5 + j) + (rowHeight - pic.TextHeight(strTemp)) / 2
Else
pic.CurrentX = curx + colWidth * i + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * (5 + j) + (rowHeight - pic.TextHeight(strTemp)) / 2
End If
pic.Print strTemp
Next
Next
''////////写第四段数据
For i = 1 To 8
strTemp = TempDmyData.dmyRep(5 * j + i + 8)
pic.CurrentX = curx + colWidth * (i - 1) + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 9 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
Next
''////////写备注数据
strTemp = TempDmyData.dmyRep(32)
pic.CurrentX = curx + colWidth
pic.CurrentY = curY - curHeight + rowHeight * 10 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
''////////写人名
For i = 2 To 10 Step 2 '写数据
strTemp = TempDmyData.dmyRep(i / 2 + 32)
pic.CurrentX = curx + (curWidth / 10) * (i - 1) + (curWidth / 10 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 11 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
Next
End Function
'画数据报表
Function drawDataReport(pic As Object)
'**********************************************************************
'* 函数名称: drawDataReport
'* 函数描述: 数据列表
'* 参数列表: pic画图控件
'* 作 者:
'* 创建日期: 2007-10-08
'**********************************************************************
Dim i As Integer, j As Integer, k As Integer, l As Integer
Dim strTemp As String
Dim oldFont As Long
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single '绘图区域
Dim colWidth As Single, rowHeight As Single
Dim strhead(1 To 4) As String
'----------
curx = pic.Width * 0.02
curWidth = pic.Width * 0.96
curY = pic.Height * 0.975
curHeight = pic.Height * 0.95
oldFont = pic.FontSize
pic.FontSize = 12
strTemp = DataRepTitle
curHeight = curHeight - pic.TextHeight(strTemp) * 1.25
colWidth = curWidth / 28
rowHeight = curHeight / 51
pic.CurrentX = curx + (curWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = ((curY - curHeight) - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
pic.FontSize = 8
strhead(1) = "序号": strhead(2) = "液面深": strhead(3) = "套压": strhead(4) = "时间(s)"
For i = 0 To 28
Select Case i Mod 4
Case 1
pic.Line (curx + colWidth * (i - 0.2), curY)-(curx + colWidth * (i - 0.2), curY - curHeight)
Case Else
pic.Line (curx + colWidth * i, curY)-(curx + colWidth * i, curY - curHeight)
End Select
Next
For i = 0 To 51
pic.Line (curx, curY - curHeight + rowHeight * i)-(curx + curWidth, curY - curHeight + rowHeight * i)
Next
For i = 1 To 28
For j = 1 To 51
k = IIf(i Mod 4 = 0, 4, i Mod 4)
'打印内容
If j = 1 Then
strTemp = strhead(k)
Else
l = ((i - 1) \ 4) * 50 + j - 1
If l <= UBound(TempDmyData.dmyYT) Then
Select Case k
Case 1
strTemp = CStr(l)
Case 2
strTemp = Format(TempDmyData.dmyYT(l, 2), "0.00")
Case 3
strTemp = Format(TempDmyData.dmyYT(l, 3), "0.00")
Case 4
strTemp = TempDmyData.dmyYT(l, 1)
End Select
Else
strTemp = ""
End If
End If
'打印位置
Select Case k
Case 1
pic.CurrentX = curx + colWidth * (i - 1) + (colWidth * 0.8 - pic.TextWidth(strTemp)) / 2
Case 2
pic.CurrentX = curx + colWidth * (i - 1 - 0.2) + (colWidth * 1.2 - pic.TextWidth(strTemp)) / 2
Case Else
pic.CurrentX = curx + colWidth * (i - 1) + (colWidth - pic.TextWidth(strTemp)) / 2
End Select
pic.CurrentY = curY - curHeight + rowHeight * (j - 1) + (rowHeight - pic.TextHeight(strTemp))
pic.Print strTemp
Next j
Next i
pic.FontSize = oldFont
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -