📄 printfrm.frm
字号:
Set TemPage = Printer
Else
Set TemPage = Me.PrintPage
End If
'汇总表对齐方式为自动居中。
'表格颜色。
TemPage.FontName = MyDataSet.Tables(7).Rows(0).Items(40).Value '字体名称。
TemPage.FontSize = MyDataSet.Tables(7).Rows(0).Items(41).Value '字体大小
TemPage.FontBold = MyDataSet.Tables(7).Rows(0).Items(42).Value \ 1000 '粗体.
TemPage.FontItalic = (MyDataSet.Tables(7).Rows(0).Items(42).Value Mod 1000) \ 100 '斜体.
TemPage.FontStrikethru = (MyDataSet.Tables(7).Rows(0).Items(42).Value Mod 100) \ 10 '下划线.
TemPage.FontUnderline = (MyDataSet.Tables(7).Rows(0).Items(42).Value Mod 10) \ 1 '删除线.
TemPage.ForeColor = MyDataSet.Tables(7).Rows(0).Items(43).Value '颜色.
TemPage.FillColor = MyDataSet.Tables(7).Rows(0).Items(43).Value '颜色.
'计算行高。
TemNum = 0
For ForIndex = 0 To 4 '取得每天总节数。
TemNum = TemNum + MyDataSet.Tables(7).Rows(0).Items(ForIndex).Value
Next
TemNum = TemNum + 2 '表格列标题占2行(包括教学日名称及班级名称)。
OneTableRowCount = TemNum '一个表格所占的行数(一天的节数)。
RowHeight = (TemPage.ScaleHeight - (MyDataSet.Tables(7).Rows(0).Items(9).Value + MyDataSet.Tables(7).Rows(0).Items(10).Value)) / TemNum
'计算列宽。
TemNum = MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2 '行标题占2行(包括时段及节数)。
ColWidth = (TemPage.ScaleWidth - (MyDataSet.Tables(7).Rows(0).Items(11).Value + MyDataSet.Tables(7).Rows(0).Items(12).Value)) / TemNum
'画纵向表格线。
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value)-(MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * OneTableRowCount)
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * 2)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * OneTableRowCount)
For TableX = 0 To MyDataSet.Tables(6).RowCount - 1
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ((TableX + 0) * MyDataSet.Tables(0).RowCount + 2) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ((TableX + 0) * MyDataSet.Tables(0).RowCount + 2) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * OneTableRowCount)
For TableY = 1 To MyDataSet.Tables(0).RowCount
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ((TableX + 0) * MyDataSet.Tables(0).RowCount + 2 + TableY) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ((TableX + 0) * MyDataSet.Tables(0).RowCount + 2 + TableY) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * OneTableRowCount)
Next
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ((TableX + 1) * MyDataSet.Tables(0).RowCount + 2) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ((TableX + 1) * MyDataSet.Tables(0).RowCount + 2) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * OneTableRowCount)
Next
'画横向表格线。
For TableX = 0 To 2
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + (TableX Mod 2) * 2 * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + TableX * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + TableX * RowHeight)
Next
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(0).Value
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + TableX) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + TableX) * RowHeight)
Next
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value) * RowHeight)
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(1).Value
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + TableX) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + TableX) * RowHeight)
Next
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value) * RowHeight)
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(2).Value
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + TableX) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + TableX) * RowHeight)
Next
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value) * RowHeight)
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(3).Value
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + TableX) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + TableX) * RowHeight)
Next
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value) * RowHeight)
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(4).Value
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value + TableX) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value + TableX) * RowHeight)
Next
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value + MyDataSet.Tables(7).Rows(0).Items(4).Value) * RowHeight)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * (MyDataSet.Tables(0).RowCount * MyDataSet.Tables(6).RowCount + 2), MyDataSet.Tables(7).Rows(0).Items(9).Value + (2 + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value + MyDataSet.Tables(7).Rows(0).Items(4).Value) * RowHeight)
'画斜线。
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * 2, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight)
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth * 2, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight + RowHeight / 6 * 5)
TemPage.Line (MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value)-(MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * 2)
'填写项目名称。
OutTextUp TemPage, "时", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth / 5 * 3, MyDataSet.Tables(7).Rows(0).Items(9).Value, ColWidth, RowHeight / 2
OutTextUp TemPage, "间", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth + ColWidth / 8, MyDataSet.Tables(7).Rows(0).Items(9).Value, ColWidth, RowHeight
OutTextUp TemPage, "班", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth / 5 * 3, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight / 2, ColWidth, RowHeight / 2
OutTextUp TemPage, "级", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth + ColWidth / 5, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight, ColWidth, RowHeight / 2
OutTextUp TemPage, "项", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth / 3, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight, ColWidth, RowHeight / 3
OutTextUp TemPage, "目", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight + RowHeight / 3 * 2, ColWidth, RowHeight / 3
OutTextUp TemPage, "分 段", MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth / 8, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight + RowHeight / 6, ColWidth / 5 * 3, RowHeight / 3 * 2, 1
If MyDataSet.Tables(7).Rows(0).Items(0).Value > 0 Then
OutTextUp TemPage, "早上", MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * 2, ColWidth, RowHeight * MyDataSet.Tables(7).Rows(0).Items(0).Value, 1
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(0).Value
OutTextUp TemPage, CStr(TableX), MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (1 + TableX), ColWidth, RowHeight, 1
Next
End If
If MyDataSet.Tables(7).Rows(0).Items(1).Value > 0 Then
OutTextUp TemPage, "上午", MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (MyDataSet.Tables(7).Rows(0).Items(0).Value + 2), ColWidth, RowHeight * MyDataSet.Tables(7).Rows(0).Items(1).Value, 1
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(1).Value
OutTextUp TemPage, CStr(TableX), MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (1 + TableX + MyDataSet.Tables(7).Rows(0).Items(0).Value), ColWidth, RowHeight, 1
Next
End If
If MyDataSet.Tables(7).Rows(0).Items(2).Value > 0 Then
OutTextUp TemPage, "中午", MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + 2), ColWidth, RowHeight * MyDataSet.Tables(7).Rows(0).Items(2).Value, 1
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(2).Value
OutTextUp TemPage, CStr(TableX), MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (1 + TableX + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value), ColWidth, RowHeight, 1
Next
End If
If MyDataSet.Tables(7).Rows(0).Items(3).Value > 0 Then
OutTextUp TemPage, "下午", MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + 2), ColWidth, RowHeight * MyDataSet.Tables(7).Rows(0).Items(3).Value, 1
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(3).Value
OutTextUp TemPage, CStr(TableX), MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (1 + TableX + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value), ColWidth, RowHeight, 1
Next
End If
If MyDataSet.Tables(7).Rows(0).Items(4).Value > 0 Then
OutTextUp TemPage, "晚上", MyDataSet.Tables(7).Rows(0).Items(11).Value, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value + 2), ColWidth, RowHeight * MyDataSet.Tables(7).Rows(0).Items(4).Value, 1
For TableX = 1 To MyDataSet.Tables(7).Rows(0).Items(4).Value
OutTextUp TemPage, CStr(TableX), MyDataSet.Tables(7).Rows(0).Items(11).Value + ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight * (1 + TableX + MyDataSet.Tables(7).Rows(0).Items(0).Value + MyDataSet.Tables(7).Rows(0).Items(1).Value + MyDataSet.Tables(7).Rows(0).Items(2).Value + MyDataSet.Tables(7).Rows(0).Items(3).Value), ColWidth, RowHeight, 1
Next
End If
For TableX = 0 To MyDataSet.Tables(6).RowCount - 1
OutTextUp TemPage, MyDataSet.Tables(6).Rows(TableX).Items(0).Value, MyDataSet.Tables(7).Rows(0).Items(11).Value + (TableX * MyDataSet.Tables(0).RowCount + 2) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value, MyDataSet.Tables(0).RowCount * ColWidth, RowHeight
For TableY = 0 To MyDataSet.Tables(0).RowCount - 1
OutTextUp TemPage, MyDataSet.Tables(0).Rows(TableY).Items(0).Value, MyDataSet.Tables(7).Rows(0).Items(11).Value + (TableX * MyDataSet.Tables(0).RowCount + TableY + 2) * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + RowHeight, ColWidth, RowHeight, 1
Next
Next
'填充数据。
For RowIndex = 0 To MyDataSet.Tables(8).RowCount - 1
For ColIndex = 8 To 27
DispNum = MyDataSet.Tables(8).Rows(RowIndex).Items(ColIndex).Value
If DispNum > 0 Then '发现一个排课标志。
'取出要显示的文本。(如果DataMode=4则取科目名称,如果DataMode=5则取教师姓名)
TemStr = MyDataSet.Tables(2 - (DataMode Mod 5)).Rows(MyDataSet.Tables(8).Rows(RowIndex).Items(2 - (DataMode Mod 5)).Value).Items(0).Value
'确定显示单元格行位置。
TemNum = 0
For TableY = 1 To ((DispNum Mod 100) \ 10) - 1 Step 1
TemNum = TemNum + MyDataSet.Tables(7).Rows(0).Items(TableY - 1).Value
Next
TableY = TemNum + DispNum Mod 10 + 1
TableX = MyDataSet.Tables(0).RowCount * ((DispNum \ 100) - 1) + MyDataSet.Tables(8).Rows(RowIndex).Items(0).Value + 2
TemNum = MyDataSet.Tables(8).Rows(RowIndex).Items(ColIndex).Value
'决定排课标志是否在显示范围内(用户修改课表结构后,不会显示无用的信息)。
If TemNum \ 100 <= MyDataSet.Tables(6).RowCount Then
'排课天数合法。
If (TemNum Mod 100) \ 10 <= 5 Then
'时段值合法。
If (TemNum Mod 10) <= MyDataSet.Tables(7).Rows(0).Items((TemNum Mod 100) \ 10 - 1).Value Then
'课时值合法。
OutTextUp TemPage, TemStr, MyDataSet.Tables(7).Rows(0).Items(11).Value + TableX * ColWidth, MyDataSet.Tables(7).Rows(0).Items(9).Value + TableY * RowHeight, ColWidth, RowHeight, 1
End If
End If
End If
End If
Next
Next
End Sub
Private Sub OutTextUp(ByVal OutObject As Object, ByVal OutText As String, ByVal OutLeft As Long, ByVal OutTop As Long, ByVal StepWidth As Long, ByVal StepHeight As Long, Optional ByVal OutMode As Integer = 0) '显示文字(自动居中)。
On Error Resume Next
'自动居中纵向显示文本。
Dim TemNum As Long
Dim TemStr As String
If OutText = "" Then Exit Sub '空字符串不用显示。
Select Case OutMode
Case 0: '水平显示,自动居中。
OutObject.CurrentY = OutTop + (StepHeight - OutObject.TextHeight(OutText)) / 2
OutObject.CurrentX = OutLeft + (StepWidth - OutObject.TextWidth(OutText)) / 2
OutObject.Print OutText
Case 1: '垂直显示,自动居中。
OutObject.CurrentY = OutTop + (StepHeight - OutObject.TextHeight(OutText) * Len(OutText)) / 2
For TemNum = 1 To Len(OutText)
TemStr = Mid(OutText, TemNum, 1)
OutObject.CurrentX = OutLeft + (StepWidth - OutObject.TextWidth(TemStr)) / 2
OutObject.Print TemStr
Next
Case 2: '垂直显示,自动居上。
OutObject.CurrentY = OutTop
For TemNum = 1 To Len(OutText)
TemStr = Mid(OutText, TemNum, 1)
OutObject.CurrentX = OutLeft + (StepWidth - OutObject.TextWidth(TemStr)) / 2
OutObject.Print TemStr
Next
Case 3: '垂直显示,自动居下。
OutObject.CurrentY = OutTop + StepHeight - OutObject.TextHeight(OutText) * Len(OutText)
For TemNum = 1 To Len(OutText)
TemStr = Mid(OutText, TemNum, 1)
OutObject.CurrentX = OutLeft + (StepWidth - OutObject.TextWidth(TemStr)) / 2
OutObject.Print TemStr
Next
End Select
End Sub
Private Sub OutDispart(Optional ByVal PrintMode As Boolean = False) '打印分表。
On Error Resume Next
Dim RowHeight As Double '行高。
Dim ColWidth As Double '列宽。
Dim TableLeft As Double '表格左上角横坐标。
Dim TableTop As Double '表格左上角纵坐标。
Dim ForIndex As Long
Dim TemNum As Double
Dim TemStr As String
Dim OneTableRowCount As Double '一个表格所占的高度。
Dim OneTableColCount As Double '一个表格所占的宽度。
Dim TableX As Long '横向表格索引。
Dim TableY As Long '纵向表格索引。
Dim TemPage As Object
If PrintMode = True Then
Set TemPage = Printer
Else
Set TemPage = Me.PrintPage
End If
'判断是否可以翻页。
If MyDataSet.Tables(DataMode Mod 2 + Abs(DataMode = 4) * 3).RowCount > (PageIndex + 1) * MyDataSet.Tables(7).Rows(0).Items(21).Value * MyDataSet.Tables(7).Rows(0).Items(22).Value Then
PrintCom(2).Enabled = True
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -