📄 mjianding.bas
字号:
Attribute VB_Name = "mJianDing"
Public JDData As JianDingYaLi '检定数据
Public YMData As JianDingYeMian '液面检定数据
Const JianDingTitle = "液面自动监测仪检定记录"
Const YeMianJianDing = "液面自动监测仪液面检定记录"
Function drawJianDingYeMianBaoBiao(pic As PictureBox, Optional BaoBiao = True)
'**********************************************************************
'* 函数名称: drawJianDingYeMianBaoBiao
'* 函数描述: 绘制液面检定报表
'* 参数列表: pic画图控件
'* 作 者:
'* 创建日期: 2008-03-10
'**********************************************************************
'On Error Resume Next
Dim tempPiont As Long
Dim avgPiont As Single
Dim oldFontSize As Long
Dim strTemp As String
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single '绘图区域
Dim rowHeight As Single, colWidth As Single
Dim x1 As Single, x2 As Single, y1 As Single, y2 As Single
Dim bx As Single, byh As Single, byl As Single
Dim i As Integer, j As Integer
If BaoBiao Then '打印报表
'打印标题
curx = pic.Width * 0.1
curWidth = pic.Width * 0.8
curY = pic.Height * 0.9
curHeight = pic.Height * 0.8
oldFontSize = pic.FontSize
pic.FontSize = 18
pic.FontBold = True
strTemp = YeMianJianDing
pic.CurrentX = curx + (curWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = ((curY - curHeight) - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
pic.FontSize = 12
pic.FontBold = False
'绘制说明
rowHeight = curHeight / 10
colWidth = curWidth / 6
For i = 1 To 6
strTemp = YMData.JianDingYeMianCol(i) & YMData.JianDianYeMianColData(i)
pic.CurrentX = curx + colWidth * (i - 1) '+ (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = YMData.JianDingYeMianCol(6 + i) & YMData.JianDianYeMianColData(6 + i)
pic.CurrentX = curx + colWidth * (i - 1)
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
Next
strTemp = YMData.JianDingYeMianCol(13) & YMData.JianDianYeMianColData(13)
pic.CurrentX = curx + colWidth * 4
pic.CurrentY = curY - rowHeight / 2
pic.Print strTemp
curHeight = curHeight - rowHeight * 4
curY = curY - rowHeight
pic.FontSize = oldFontSize
Else '在pic上显示
curx = 0
curWidth = pic.Width
curY = pic.Height
curHeight = pic.Height
'
End If
pic.Line (curx, curY)-(curx + curWidth, curY - curHeight), , B
''画高低频曲线
tempPiont = UBound(YMData.JianDingYeMiandata, 1) - 1
'tempPiont = 5500
bx = curWidth / tempPiont
byh = (curHeight / 12) / YMData.GaoPinZuiDa '高频比例
byl = (curHeight / 12) / YMData.DiPinZuiDa '低频比例
YMData.JianDingYeMiandata(0, 3) = curx
For i = 1 To tempPiont
x1 = curx + (i - 1) * bx
x2 = curx + i * bx
y1 = (curY - curHeight * 8 / 12) - YMData.JianDingYeMiandata(i - 1, 1) * byl
y2 = (curY - curHeight * 8 / 12) - YMData.JianDingYeMiandata(i, 1) * byl
pic.Line (x1, y1)-(x2, y2), vbBlue
'----------------
' 真的
y1 = (curY - curHeight * 3 / 12) - YMData.JianDingYeMiandata(i - 1, 2) * byh
y2 = (curY - curHeight * 3 / 12) - YMData.JianDingYeMiandata(i, 2) * byh
'' 假的
' y1 = (curY - curHeight * 3 / 12) - YMData.JianDingYeMiandata(i - 1, 1) * byl
' y2 = (curY - curHeight * 3 / 12) - YMData.JianDingYeMiandata(i, 1) * byl
''---------
pic.Line (x1, y1)-(x2, y2), vbRed
YMData.JianDingYeMiandata(i, 3) = x2
Next
'绘制刻度
If BaoBiao Then
If YMData.DianYi <> "" And YMData.DianWuShi <> "" Then
avgPiont = (YMData.DianWuShi - YMData.DianYi) / 20
For i = 1 To 21
x1 = curx + (YMData.DianYi + avgPiont * (i - 1)) * bx
pic.Line (x1, curY - curHeight)-(x1, curY - curHeight - 100)
pic.Line (x1, curY)-(x1, curY + 100)
If (i Mod 2) = 1 Then
strTemp = Format(0.1 * (i \ 2), "0.0")
pic.CurrentX = x1
pic.CurrentY = curY + 100
pic.Print strTemp
pic.CurrentX = x1
pic.CurrentY = curY - curHeight + 50
pic.Print strTemp
End If
Next
End If
Else
End If
'绘制直线
If YMData.DianYi <> "" Then
x1 = curx + YMData.DianYi * bx
pic.Line (x1, curY - pic.TextHeight("A"))-(x1, curY - curHeight + pic.TextHeight("A"))
strTemp = "0"
pic.CurrentX = x1 + pic.TextWidth("A")
pic.CurrentY = curY - curHeight + pic.TextHeight("A") * 2.5
pic.Print strTemp
End If
If YMData.DianWuShi <> "" Then
x1 = curx + YMData.DianWuShi * bx
pic.Line (x1, curY - pic.TextHeight("A"))-(x1, curY - curHeight + pic.TextHeight("A"))
strTemp = "50"
pic.CurrentX = x1 + pic.TextWidth("A")
pic.CurrentY = curY - curHeight + pic.TextHeight("A") * 2.5
pic.Print strTemp
End If
End Function
Function drawJianDingBaoBiao(pic As Object)
'**********************************************************************
'* 函数名称: drawJianDingBaoBiao
'* 函数描述: 绘制压力检定报告
'* 参数列表: pic画图控件
'* 作 者:
'* 创建日期: 2008-03-07
'**********************************************************************
Dim i As Integer, j As Integer
Dim strTemp As String
Dim oldFont As Long
Dim curx As Single, curY As Single, curX1 As Single, curY1 As Single, curWidth As Single, curHeight As Single '绘图区域
Dim colWidth As Single, rowHeight As Single
'---绘图区域
curx = pic.Width * 0.1
curWidth = pic.Width * 0.8
curY = pic.Height * 0.95
curHeight = pic.Height * 0.9
'绘制标题
oldFont = pic.FontSize
pic.FontSize = 18
pic.FontBold = True
strTemp = JianDingTitle
curHeight = curHeight - pic.TextHeight(strTemp) * 1.25
colWidth = curWidth / 10.5
rowHeight = curHeight / 17
pic.CurrentX = curx + (curWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = ((curY - curHeight) - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
pic.FontSize = 12
pic.FontBold = False
'绘制网格
'绘制横线
For i = 1 To 17
Select Case i
Case 2, 17
pic.Line (curx, curY - curHeight + rowHeight * i)-(curx, curY - curHeight + rowHeight * i)
Case 4
pic.Line (curx + colWidth * 0.5, curY - curHeight + rowHeight * i)-(curx + colWidth * 6.5, curY - curHeight + rowHeight * i)
Case 5
pic.Line (curx + colWidth * 0.5, curY - curHeight + rowHeight * i)-(curx + colWidth * 8.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 = 1 To 12
Select Case i
Case 1
pic.Line (curx, curY - rowHeight)-(curx, curY - rowHeight * 16)
Case 12
pic.Line (curx + curWidth, curY - rowHeight)-(curx + curWidth, curY - rowHeight * 16)
Case 2, 8, 10, 11
pic.Line (curx + colWidth * (i - 1.5), curY - rowHeight * 2)-(curx + colWidth * (i - 1.5), curY - rowHeight * 14)
Case 3
pic.Line (curx + colWidth * (i - 1.5), curY - rowHeight)-(curx + colWidth * (i - 1.5), curY - rowHeight * 12)
Case 4, 6
pic.Line (curx + colWidth * (i - 1.5), curY - rowHeight * 2)-(curx + colWidth * (i - 1.5), curY - rowHeight * 13)
Case Else
pic.Line (curx + colWidth * (i - 1.5), curY - rowHeight * 2)-(curx + colWidth * (i - 1.5), curY - rowHeight * 12)
End Select
Next
'绘制文字
'1
strTemp = JDData.JianDingYaLiCol(1) & JDData.JainDingYaLiColData(1)
pic.CurrentX = curx
pic.CurrentY = curY - curHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(2) & JDData.JainDingYaLiColData(2)
pic.CurrentX = curx + colWidth * 7.5
pic.CurrentY = curY - curHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'2
strTemp = JDData.JianDingYaLiCol(3) & JDData.JainDingYaLiColData(3)
pic.CurrentX = curx + 10
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(4) & JDData.JainDingYaLiColData(4)
pic.CurrentX = curx + colWidth * 2.5
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(5) & JDData.JainDingYaLiColData(5)
pic.CurrentX = curx + colWidth * 5
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(6) & JDData.JainDingYaLiColData(6)
pic.CurrentX = curx + colWidth * 7.5
pic.CurrentY = curY - curHeight + rowHeight + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'3
strTemp = JDData.JianDingYaLiCol(7) & JDData.JainDingYaLiColData(7)
pic.CurrentX = curx + 10
pic.CurrentY = curY - curHeight + rowHeight * 2 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(8) & JDData.JainDingYaLiColData(8)
pic.CurrentX = curx + colWidth * 2.5
pic.CurrentY = curY - curHeight + rowHeight * 2 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(9) & JDData.JainDingYaLiColData(9)
pic.CurrentX = curx + colWidth * 5
pic.CurrentY = curY - curHeight + rowHeight * 2 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'4
strTemp = "试验"
pic.CurrentX = curx + (colWidth * 0.5 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 3 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "压 力 示 值 MPa"
pic.CurrentX = curx + colWidth * 0.5 + (colWidth * 6 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 3 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "平 均 值"
pic.CurrentX = curx + colWidth * 6.5 + (colWidth * 2 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 3 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "最 大"
pic.CurrentX = curx + colWidth * 8.5 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 3 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "示 值"
pic.CurrentX = curx + colWidth * 9.5 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 3 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'5
strTemp = "套压"
pic.CurrentX = curx + (colWidth * 0.5 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "一次"
pic.CurrentX = curx + colWidth * 0.5 + (colWidth * 2 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "两次"
pic.CurrentX = curx + colWidth * 2.5 + (colWidth * 2 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "三次"
pic.CurrentX = curx + colWidth * 4.5 + (colWidth * 2 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "MPa"
pic.CurrentX = curx + colWidth * 6.5 + (colWidth * 2 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "误 差"
pic.CurrentX = curx + colWidth * 8.5 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "误 差"
pic.CurrentX = curx + colWidth * 9.5 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 4 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'6
strTemp = "MPa"
pic.CurrentX = curx + (colWidth * 0.5 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 5 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
For i = 0 To 3
strTemp = "加载"
pic.CurrentX = curx + colWidth * (0.5 + i * 2) + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 5 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "减载"
pic.CurrentX = curx + colWidth * (0.5 + i * 2 + 1) + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 5 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
Next
strTemp = "Sx"
pic.CurrentX = curx + colWidth * 8.5 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 5 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = "MPa"
pic.CurrentX = curx + colWidth * 9.5 + (colWidth - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 5 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
'16
strTemp = "检定结果"
pic.CurrentX = curx + (colWidth * 1.5 - pic.TextWidth(strTemp)) / 2
pic.CurrentY = curY - curHeight + rowHeight * 15 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(10) & JDData.JainDingYaLiColData(10)
pic.CurrentX = curx + colWidth * 1.5 + 50
pic.CurrentY = curY - curHeight + rowHeight * 15 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(11) & JDData.JainDingYaLiColData(11)
pic.CurrentX = curx + colWidth * 4.5
pic.CurrentY = curY - curHeight + rowHeight * 15 + (rowHeight - pic.TextHeight(strTemp)) / 2
pic.Print strTemp
strTemp = JDData.JianDingYaLiCol(12) & JDData.JainDingYaLiColData(12)
pic.CurrentX = curx + colWidth * 7.5
pic.CurrentY = curY - curHeight + rowHeight * 15 + (rowHeight - pic.TextHeight(strTemp)) / 2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -