📄 frmchart1.frm
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form frmChart1
Caption = "Employees Workinghours Chart"
ClientHeight = 6600
ClientLeft = 60
ClientTop = 450
ClientWidth = 7560
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 6600
ScaleWidth = 7560
Begin VB.CommandButton Command1
Caption = "Print"
Height = 495
Left = 7080
TabIndex = 4
Top = 360
Width = 1455
End
Begin MSChart20Lib.MSChart MSChart1
Height = 4455
Left = 4560
OleObjectBlob = "frmChart1.frx":0000
TabIndex = 0
Top = 2880
Width = 5895
End
Begin VB.Label Label1
Caption = "Employee Name"
BeginProperty Font
Name = "Times New Roman"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Index = 1
Left = 6840
TabIndex = 3
Top = 7440
Width = 1695
End
Begin VB.Label Label1
Caption = "(Hours)"
BeginProperty Font
Name = "Times New Roman"
Size = 9.75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Index = 0
Left = 10560
TabIndex = 2
Top = 5040
Width = 735
End
Begin VB.Label Label2
BeginProperty Font
Name = "Times New Roman"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 615
Left = 4560
TabIndex = 1
Top = 2040
Width = 6375
End
End
Attribute VB_Name = "frmChart1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public mrc As ADODB.Recordset
Public txtSQL As String
Public MsgText As String
Private Sub Command1_Click()
'复制 MSChart 控制项的内容,包括图表及资料
MSChart1.EditCopy
Printer.Print " "
'从剪贴簿中抓出文字资料来打印
Printer.Print Clipboard.GetText(vbCFText)
Printer.Print " "
Printer.Print Label2
'Printer.Print Label1(0)
'从剪贴簿中抓出图表来打印
Printer.PaintPicture Clipboard.GetData(), 0, 2500
Printer.EndDoc
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim colNo As Integer
Dim rowNo As Integer
txtSQL = "select Pro_name from ProjectTable"
Set mrc = ExecuteSQL(txtSQL, MsgText)
colNo = mrc.RecordCount + 7
mrc.Close
txtSQL = "select Em_id,Em_name from EmployeeTable"
Set mrc = ExecuteSQL(txtSQL, MsgText)
rowNo = mrc.RecordCount + 2
mrc.Close
'用重新定义数组可以定义动态数组
ReDim arrPrices(1 To rowNo - 2, 1 To 2) As String
For i = 1 To (rowNo - 2)
arrPrices(i, 1) = frmCheckChart.msgList.TextMatrix(i, 1)
arrPrices(i, 2) = frmCheckChart.msgList.TextMatrix(i, (colNo - 1))
Next i
MSChart1.ChartData = arrPrices
txtSQL = "select * from BaseCheckTable"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'This chart shows everyone's total working hours each month.
Label2.Caption = "This chart shows everyone's total working hours of " & mrc.Fields(0)
mrc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -