📄 form3.frm
字号:
End If
If (List1.Text = "启动曲线") Then
If (t <= 4.9) Then
t = t + 0.1
marx1 = marx1 + Shape2.Width / 50
mary1 = Shape2.Height - Val(qdrd.Fields("转矩")) * Shape2.Height / 25 - Shape2.Height / 50
speedx1 = speedx1 + Shape1.Width / 50
speedy1 = Shape1.Height - Val(qdrd.Fields("速度")) * Shape1.Height / 3000
currentx1 = currentx1 + Shape3.Width / 50
currenty1 = Shape3.Height - Val(qdrd.Fields("电流")) * Shape1.Height / 30
qdrd.MoveNext
Picture2.Line (marx0, mary0)-(marx1, mary1), RGB(255, 0, 0)
marx0 = marx1
mary0 = mary1
Picture1.Line (speedx0, speedy0)-(speedx1, speedy1), RGB(255, 0, 0)
speedx0 = speedx1
speedy0 = speedy1
Picture3.Line (currentx0, currenty0)-(currentx1, currenty1), RGB(255, 0, 0)
currentx0 = currentx1
currenty0 = currenty1
Else
Timer1.Enabled = False
Frame2.Enabled = True
Command4.Enabled = True
End If
End If
If (List1.Text = "堵转曲线") Then
If (t <= 4.9) Then
t = t + 0.1
marx1 = marx1 + Shape2.Width / 50
mary1 = Shape2.Height - Val(dzrd.Fields("转矩")) * Shape2.Height / 25 - Shape2.Height / 50
speedx1 = speedx1 + Shape1.Width / 50
speedy1 = Shape1.Height - Val(dzrd.Fields("速度")) * Shape1.Height / 3000
currentx1 = currentx1 + Shape3.Width / 50
currenty1 = Shape3.Height - Val(dzrd.Fields("电流")) * Shape1.Height / 30
dzrd.MoveNext
Picture2.Line (marx0, mary0)-(marx1, mary1), RGB(255, 0, 0)
marx0 = marx1
mary0 = mary1
Picture1.Line (speedx0, speedy0)-(speedx1, speedy1), RGB(255, 0, 0)
speedx0 = speedx1
speedy0 = speedy1
Picture3.Line (currentx0, currenty0)-(currentx1, currenty1), RGB(255, 0, 0)
currentx0 = currentx1
currenty0 = currenty1
Else
Timer1.Enabled = False
Frame2.Enabled = True
Command4.Enabled = True
End If
End If
End Sub
Private Sub printreport()
strdate = Mid(reportrd.Fields("表名"), 1, 8)
strnum = Mid(reportrd.Fields("表名"), 16, Len(reportrd.Fields("表名")) - 15)
Dim w1, h1
Dim x1, y1, x2
Printer.ScaleMode = vbPoints
mingtopmargin = 12
mingleftmargin = 50
mingheaderfontsize = 20
mingbodyfontsize = 14
mstrheaderfontname = "arial"
mstrbodyfontname = "times new roman"
w1 = 120
h1 = 40
x1 = mingleftmargin
y1 = mingtopmargin + 100
x2 = 15
Printer.CurrentX = mingleftmargin + 150
Printer.CurrentY = mingtopmargin + 50
With Printer.Font
.Name = mstrheaderfontname
.size = mingheaderfontsize
.Bold = True
End With
Printer.Print "电机试验数据报表"
Printer.CurrentX = mingleftmargin + 300
Printer.CurrentY = mingtopmargin + 75
With Printer.Font
.Name = mstrbodyfontname
.size = 14
.Bold = False
End With
Printer.Print "报表编号: "
Printer.Line (x1, y1)-(x1 + 4 * w1, y1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 5
Printer.Print " 铭牌项目 "
Printer.CurrentX = x1 + x2 + w1
Printer.CurrentY = y1 + 5
Printer.Print " 铭牌数据 "
Printer.CurrentX = x1 + x2 + w1 + w1
Printer.CurrentY = y1 + 5
Printer.Print " 测量项目 "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 8
Printer.CurrentY = y1 + 5
Printer.Print " 测量数据 "
Printer.Line (x1, y1 + h1)-(x1 + 4 * w1, y1 + h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + h1 + 5
Printer.Print " 试验日期 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + h1 + 5
Printer.Print strdate
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + h1 + 5
Printer.Print " 试验空载电流(A) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + h1 + 5
Printer.Print reportrd.Fields("试验空载电流")
Printer.Line (x1, y1 + 2 * h1)-(x1 + 4 * w1, y1 + 2 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 2 * h1 + 5
Printer.Print " 电机型号 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 2 * h1 + 5
Printer.Print reportrd.Fields("电机型号")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 2 * h1 + 5
Printer.Print " 试验空载转速(rpm) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 2 * h1 + 5
Printer.Print reportrd.Fields("试验空载转速")
Printer.Line (x1, y1 + 3 * h1)-(x1 + 4 * w1, y1 + 3 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 3 * h1 + 5
Printer.Print " 编 号 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 3 * h1 + 5
Printer.Print strnum
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 3 * h1 + 5
Printer.Print " 试验空载转矩(N.m) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 3 * h1 + 5
Printer.Print reportrd.Fields("试验空载转矩")
Printer.Line (x1, y1 + 4 * h1)-(x1 + 4 * w1, y1 + 4 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 4 * h1 + 5
Printer.Print " 生产厂家 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 4 * h1 + 5
Printer.Print reportrd.Fields("出厂厂家")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 4 * h1 + 5
Printer.Print " 试验额定电流(A) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 4 * h1 + 5
Printer.Print reportrd.Fields("试验额定电流")
Printer.Line (x1, y1 + 5 * h1)-(x1 + 4 * w1, y1 + 5 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 5 * h1 + 5
Printer.Print " 出厂时间 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 5 * h1 + 5
Printer.Print reportrd.Fields("出厂日期")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 5 * h1 + 5
Printer.Print " 试验额定转速(rpm) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 5 * h1 + 5
Printer.Print reportrd.Fields("试验额定转速")
Printer.Line (x1, y1 + 6 * h1)-(x1 + 4 * w1, y1 + 6 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 6 * h1 + 5
Printer.Print " 防护等级 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 6 * h1 + 5
Printer.Print reportrd.Fields("防护等级")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 6 * h1 + 5
Printer.Print " 试验额定转矩(N.m) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 6 * h1 + 5
Printer.Print reportrd.Fields("试验额定转矩")
Printer.Line (x1, y1 + 7 * h1)-(x1 + 4 * w1, y1 + 7 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 7 * h1 + 5
Printer.Print " 额定功率 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 7 * h1 + 5
Printer.Print reportrd.Fields("额定功率")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 7 * h1 + 5
Printer.Print " 试验启动电流(A) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 7 * h1 + 5
Printer.Print reportrd.Fields("试验启动电流")
Printer.Line (x1, y1 + 8 * h1)-(x1 + 4 * w1, y1 + 8 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 8 * h1 + 5
Printer.Print " 额定电流 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 8 * h1 + 5
Printer.Print reportrd.Fields("额定电流")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 8 * h1 + 5
Printer.Print " 试验启动转矩(N.m) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 8 * h1 + 5
Printer.Print reportrd.Fields("试验启动转矩")
Printer.Line (x1, y1 + 9 * h1)-(x1 + 4 * w1, y1 + 9 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + x2
Printer.CurrentY = y1 + 9 * h1 + 5
Printer.Print " 额定电压 "
Printer.CurrentX = x1 + x2 + w1 + 5
Printer.CurrentY = y1 + 9 * h1 + 5
Printer.Print reportrd.Fields("额定电压")
Printer.CurrentX = x1 + w1 + w1
Printer.CurrentY = y1 + 9 * h1 + 5
Printer.Print " 试验堵转电流(A) "
Printer.CurrentX = x1 + x2 + w1 + w1 + w1 + 10
Printer.CurrentY = y1 + 9 * h1 + 5
Printer.Print reportrd.Fields("试验堵转电流")
Printer.Line (x1, y1 + 10 * h1)-(x1 + 4 * w1, y1 + 10 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 8
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + 2 * w1
Printer.CurrentY = y1 + 10 * h1 + 5
Printer.Print "试验堵转转矩(N.m) "
Printer.CurrentX = x1 + x2 + 3 * w1 + 10
Printer.CurrentY = y1 + 10 * h1 + 5
Printer.Print reportrd.Fields("试验堵转转矩")
Printer.Line (x1, y1 + 11 * h1)-(x1 + 4 * w1, y1 + 11 * h1)
With Printer.Font
.Name = mstrbodyfontname
.size = 20
.Bold = False
End With
Printer.Print " "
With Printer.Font
.Name = mstrbodyfontname
.size = mingbodyfontsize
.Bold = False
End With
Printer.CurrentX = x1 + 2.5 * w1
Printer.CurrentY = y1 + 15 * h1 + 5
Printer.Print " 试验人员:_________" ' 额定转速 "
'printer.Line (mingleftmargin, mingtopmargin + 374)-(mingleftmargin + 480, mingtopmargin + 374)
'printer.Line (mingleftmargin, mingtopmargin + 404)-(mingleftmargin + 480, mingtopmargin + 404)
Printer.Line (x1, y1)-(x1, y1 + 14 * h1) ',ming
Printer.Line (x1 + w1, y1)-(x1 + w1, y1 + 14 * h1)
Printer.Line (x1 + 2 * w1, y1)-(x1 + 2 * w1, y1 + 11 * h1)
Printer.Line (x1 + 3 * w1 + 5, y1)-(x1 + 3 * w1 + 5, y1 + 11 * h1)
Printer.Line (x1 + 4 * w1, y1)-(x1 + 4 * w1, y1 + 14 * h1)
Printer.Line (x1, y1 + 14 * h1)-(x1 + 4 * w1, y1 + 14 * h1)
Printer.CurrentX = x1 + x2 + 5
Printer.CurrentY = y1 + 12 * h1 + 5
Printer.Print "备 注"
End Sub
Private Sub Timer2_Timer()
If (n <= 49) Then
Printer.Line (xs1, ys1)-(xs + 8 * n, ys - 10 * 20 / 3000 * Val(rd.Fields("速度")))
xs1 = xs + 8 * n
ys1 = ys - 10 * 20 / 3000 * Val(rd.Fields("速度"))
Printer.Line (xc1, yc1)-(xc + 8 * n, yc - 10 * 20 / 30 * Val(rd.Fields("电流")))
xc1 = xc + 8 * n
yc1 = yc - 10 * 20 / 30 * Val(rd.Fields("电流"))
Printer.Line (xm1, ym1)-(xm + 8 * n, ym - 10 * 20 / 25 * Val(rd.Fields("转矩")))
xm1 = xm + 8 * n
ym1 = ym - 10 * 20 / 25 * Val(rd.Fields("转矩"))
n = n + 1
rd.MoveNext
Else
Timer2.Enabled = False
Printer.EndDoc
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -