📄 viewprint.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form ViewPrint
ClientHeight = 6120
ClientLeft = 60
ClientTop = 345
ClientWidth = 6825
LinkTopic = "Form1"
ScaleHeight = 6120
ScaleWidth = 6825
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin MSFlexGridLib.MSFlexGrid Grid
Height = 4335
Left = 0
TabIndex = 0
Top = 1680
Width = 6735
_ExtentX = 11880
_ExtentY = 7646
_Version = 393216
FixedCols = 0
BackColorFixed = -2147483639
BackColorBkg = 16777215
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComctlLib.ImageList ImageList
Left = 0
Top = 600
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 15
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "ViewPrint.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "ViewPrint.frx":0542
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "ViewPrint.frx":0A84
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "ViewPrint.frx":0B96
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar
Align = 1 'Align Top
Height = 615
Left = 0
TabIndex = 1
Top = 0
Width = 6825
_ExtentX = 12039
_ExtentY = 1085
ButtonWidth = 820
ButtonHeight = 926
AllowCustomize = 0 'False
Appearance = 1
ImageList = "ImageList"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 8
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "预览"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 4
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "过滤"
ImageIndex = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 4
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "格式"
ImageIndex = 4
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 4
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Label LabelSub
Caption = "副标题"
Height = 375
Left = 120
TabIndex = 3
Top = 1200
Width = 5295
End
Begin VB.Label LabelMain
Alignment = 2 'Center
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "标题"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3840
TabIndex = 2
Top = 720
Width = 765
End
End
Attribute VB_Name = "ViewPrint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private m_CommandText As String
Private m_TableData As ADODB.Recordset
Private m_FindWin As Form
Private m_FormatWin As Form
Event EndWindow()
Private Sub Form_Resize()
Grid.Top = Toolbar.Height + 1010
Grid.Height = Me.Height - Toolbar.Top - 1050
Grid.Width = Me.Width - 120
Grid.Left = 5
LabelMain.Left = Me.Width / 2 - LabelMain.Width
LabelSub.Left = 20
LabelSub.Width = Me.Width - 20
End Sub
Private Sub DrawTable()
Dim i As Integer
Grid.Cols = m_TableData.Fields.COUNT
Grid.Rows = 1
Grid.Row = 0
Grid.RowHeight(0) = 400
For i = 0 To m_TableData.Fields.COUNT - 1
Grid.ColAlignment(i) = 5
Grid.Col = i
Grid.Text = m_TableData.Fields(i).Name
Next i
End Sub
Private Sub ShowData()
Dim x As Long, y As Long
Dim DataText As String
If Not (m_TableData.BOF And m_TableData.EOF) Then
m_TableData.MoveFirst
End If
y = 1
While Not m_TableData.EOF
Grid.Rows = y + 1
' Grid.Row = y
For x = 0 To m_TableData.Fields.COUNT - 1
If IsNumeric(m_TableData.Fields(x).Value) Then
If m_TableData.Fields(x).Type = adDouble Then
DataText = FormatNumber(m_TableData.Fields(x).Value)
Else
DataText = CStr(m_TableData.Fields(x).Value)
End If
Else
DataText = m_TableData.Fields(x).Value
End If
' Grid.Col = x
' Grid.CellAlignment = vbAlignLeft Or vbAlignBottom
Grid.TextMatrix(y, x) = DataText
If Grid.ColWidth(x) < TextWidth(DataText) Then Grid.ColWidth(x) = TextWidth(DataText) + 1000
' MsgBox TextWidth(DataText)
Next x
m_TableData.MoveNext
y = y + 1
Wend
End Sub
Private Sub RefreshReCode()
If g_Conn Is Nothing Then
Set g_Conn = New ADODB.Connection
With g_Conn
.Provider = g_Provider
.CommandTimeout = 7
.ConnectionTimeout = 10
.Open g_DataSource
End With
End If
If g_Conn.State = adStateClosed Then
g_Conn.Open g_DataSource
End If
Set m_TableData = g_Conn.Execute(m_CommandText)
End Sub
Private Sub Form_Unload(Cancel As Integer)
RaiseEvent EndWindow
End Sub
Public Sub ShowViwe(ByRef pFindwin As Form, ByRef pFormatWin As Form)
Set m_FindWin = pFindwin
Set m_FormatWin = pFormatWin
'If m_FindWin.DoModal() = ReturnCode.RC_OK Then
'End If
Me.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -