📄 yl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{E228A480-FDCB-11D5-A3C8-0050BF074C3F}#36.0#0"; "curtPrinter.ocx"
Begin VB.Form yl
BackColor = &H00E0E0E0&
Caption = "当年统计表"
ClientHeight = 8310
ClientLeft = -2655
ClientTop = 450
ClientWidth = 9435
Icon = "yl.frx":0000
LinkTopic = "Form7"
MDIChild = -1 'True
Picture = "yl.frx":030A
ScaleHeight = 8310
ScaleWidth = 9435
WindowState = 2 'Maximized
Begin CurtPrinter打印预览控件.CurtPrinter CurtPrinter1
Height = 3975
Left = 0
TabIndex = 0
Top = 0
Visible = 0 'False
Width = 6375
_ExtentX = 11245
_ExtentY = 7011
ForeColor = -2147483640
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ToolBarColor = -2147483644
ToolBarStyle = 2
End
Begin MSAdodcLib.Adodc Adodc3
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=dzqch"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "dzqch"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select DISTINCT hwm from hwmk order by hwm"
Caption = "Adodc3"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 960
Top = 0
Visible = 0 'False
Width = 4455
_ExtentX = 7858
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 2160
Top = 0
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=dzqch"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "dzqch"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select DISTINCT hwm from hwmk order by hwm"
Caption = "Adodc3"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc4
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=dzqch"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "dzqch"
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from ma where dw like '%重车%'"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Menu prin
Caption = "文件"
Begin VB.Menu mnuManual
Caption = "页面设置"
Begin VB.Menu mnuPageUp
Caption = "上页"
End
Begin VB.Menu mnuPageDown
Caption = "下页"
End
Begin VB.Menu mnuZoom
Caption = "显示比例"
End
Begin VB.Menu mnuPaperSize
Caption = "选择纸张"
End
Begin VB.Menu mnuOrientation
Caption = "纸张方向"
End
End
Begin VB.Menu mnuPreview
Caption = "打印预览"
End
Begin VB.Menu mnuPrint
Caption = "打印"
End
Begin VB.Menu mnunull
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "关闭"
End
End
Begin VB.Menu hlp
Caption = "帮助"
Begin VB.Menu about
Caption = "关于"
End
Begin VB.Menu neirong
Caption = "内容"
End
End
Begin VB.Menu tuichu
Caption = "退出"
Begin VB.Menu quit
Caption = "退出"
End
End
End
Attribute VB_Name = "yl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'CODE Manger By BcodeXRose
Dim listindex1
Dim listindex2
Option Explicit
Private Const MARGIN_SIZE = 60 ' 单位为缇
' 列拖拽变量
Dim sj, drq
Private m_bDragOK As Boolean
Private m_iDragCol As Integer
Private xdn As Integer, ydn As Integer
Dim sj1, sj2 As String
Dim le%, istr%
Dim ljsj
Dim ljfz
Dim i, j
Dim jl_sql As String
':Command1_Click
': 无
':PrintContent
':Optional 为ntDevice As Printer型
Public Sub PrintContent(Optional PrintDevice As Printer)
Const TableStartX = 10
If PrintDevice Is Nothing Then
CurtPrinter1.StartPrint toPreview '预览
Else
CurtPrinter1.StartPrint toPrinter '打印到打印机
End If
Dim strr
With CurtPrinter1
'一些图形方法的演示
'重新开始一页,直接打印报表,注意,它会自动换页,如果你设定了标题,它也自动打哦:)
.NewPage
'.FontSize = 18
'直接打印MSHFlexGrid
.TitleOut labl
.DirectPrint gridd
'FromDirectPrint MSHFlexGrid1, "FromDirectPrint--MSFlexGrid控件内容,表格起始水平坐标为10", , , 10
.TextOut "制表:" & jl_sby
' & Space(50) & Label4.Caption & Space(6) & strr & "吨"
'结束打印
.EndDoc
End With
End Sub
Private Sub Form_Load()
mnuPreview_Click
End Sub
Private Sub Form_Resize()
Me.CurtPrinter1.Move 0, 0, Me.Width, Me.Height
End Sub
':mnuExit_Click
': 无
Private Sub mnuExit_Click()
Unload Me
End Sub
Private Sub mnuoutput_Click()
End Sub
'预览的代码
':mnuPreview_Click
': 无
Private Sub mnuPreview_Click()
CurtPrinter1.Visible = True
mnuManual.Enabled = True
PrintContent
End Sub
'两行代码可选,一个会调用打印对话框,一个直接打印了。
':mnuPrint_Click
': 无
Private Sub mnuPrint_Click()
'CurtPrinter1.ShowPrinter
PrintContent Printer
End Sub
'点击了预览控件上的关闭,引发该事件,关闭预览窗体
':curtprinter1_ClosePreview
': 无
Private Sub curtprinter1_ClosePreview()
Unload Me
End Sub
'如果每次调整预览比例好重新生成预览的话,请将AutoRedraw设置为FALSE,然后在下面的事件添入要重画的代码
':curtprinter1_NeedRedraw
': 无
Private Sub CurtPrinter1_NeedRedraw()
PrintContent
End Sub
'写入打印叶脚的代码
':CurtPrinter1_PrintFooter
':CurrentPage 为Long型
':LeftText 为String型
':CenterText 为String型
':RightText 为String型
Private Sub CurtPrinter1_PrintFooter(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
LeftText = jl_zgdw
CenterText = Format(Now, "yyyy年m月d日")
RightText = "其他信息"
End Sub
'写入打印页眉的代码
':CurtPrinter1_PrintHeader
':CurrentPage 为Long型
':LeftText 为String型
':CenterText 为String型
':RightText 为String型
Private Sub CurtPrinter1_PrintHeader(CurrentPage As Long, LeftText As String, CenterText As String, RightText As String)
LeftText = Date
CenterText = jl_qym
RightText = "这是第 " & CurrentPage & " 页"
End Sub
'点击了预览窗体或直接调用ShowPrinter后,点击了打印机窗口的确定,引发打印代码,打印到打印机上!
':curtprinter1_RealPrint
': 无
Private Sub curtprinter1_RealPrint()
PrintContent Printer
End Sub
'如果隐藏工具条,仍可以通过简单的编程控制预览
':mnuPageDown_Click
': 无
Private Sub mnuPageDown_Click()
CurtPrinter1.PageDown
End Sub
':mnuPageSetup_Click
': 无
Private Sub mnuPageSetup_Click()
CurtPrinter1.PageSetup
End Sub
':mnuPageUp_Click
': 无
Private Sub mnuPageUp_Click()
CurtPrinter1.PageUp
End Sub
':mnuZoom_Click
': 无
Private Sub mnuZoom_Click()
CurtPrinter1.Zoom = Val(InputBox("请输入0-200之间的数字")) '0代表整页预览
End Sub
':mnuOrientation_Click
': 无
Private Sub mnuOrientation_Click()
CurtPrinter1.Orientation = IIf(CurtPrinter1.Orientation = 1, 2, 1)
End Sub
':mnuPaperSize_Click
': 无
Private Sub mnuPaperSize_Click()
Dim pager
pager = InputBox("请输入打印纸型号:")
If pager = 0 Then
Exit Sub
Else
CurtPrinter1.PaperSize = Val(InputBox("请输入打印纸型号:"))
End If
End Sub
'预览控件尺寸根据窗口调整
':Form_Unload
':Cancel 为Integer型
Private Sub form_Unload(Cancel As Integer)
If CurtPrinter1.Busy = True Then '打印预览控件忙则取消打印任务,然后就可以退出了
CurtPrinter1.CancelPrint
MsgBox "打印控件忙,稍后重试。", vbInformation
Cancel = True
End If
End Sub
'复制字体属性
':CloneFont
':Dest 为StdFont型
':Src 为StdFont型
Private Sub CloneFont(Dest As StdFont, Src As StdFont)
With Dest
.Bold = Src.Bold
.Charset = Src.Charset
.Italic = Src.Italic
.Name = Src.Name
.Size = Src.Size
.Strikethrough = Src.Strikethrough
.Underline = Src.Underline
.Weight = Src.Weight
End With
End Sub
Private Sub quit_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -