?? 圖表_繪制f2.frm
字號:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "mschrt20.ocx"
Begin VB.Form frmPicture
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "圖表"
ClientHeight = 3540
ClientLeft = 60
ClientTop = 345
ClientWidth = 2070
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 3540
ScaleWidth = 2070
StartUpPosition = 3 '窗口缺省
Begin VB.ListBox List1
Height = 1500
Left = 120
TabIndex = 6
Top = 600
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "確 定"
Height = 375
Left = 120
TabIndex = 1
Top = 2160
Width = 855
End
Begin MSChart20Lib.MSChart MSChart1
Height = 7935
Left = 1320
OleObjectBlob = "圖表_繪制F2.frx":0000
TabIndex = 2
Top = 120
Width = 9015
End
Begin VB.CommandButton cmdExit
Caption = "退 出"
Height = 375
Left = 120
TabIndex = 3
Top = 3120
Width = 855
End
Begin VB.CommandButton cmdDraw
Caption = "作 圖"
Height = 375
Left = 120
TabIndex = 0
Top = 2640
Width = 855
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Label2"
ForeColor = &H80000008&
Height = 255
Left = 240
TabIndex = 5
Top = 360
Width = 1095
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "選擇圖表類型"
ForeColor = &H80000008&
Height = 255
Left = 120
TabIndex = 4
Top = 120
Width = 1335
End
End
Attribute VB_Name = "frmPicture"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim intI As Integer, intJ As Integer
Dim intFileNumber As Integer
Dim strData As String '臨時保存數據
Dim dblData As Double '雙精度數據
Dim blnTitle As Boolean '是否有圖題
Dim blnRowLabel As Boolean '是否有行標
Dim blnColLabel As Boolean '是否有列標
Private Sub Form_Load()
cmdDraw.Visible = False
MSChart1.Visible = False
'在組合框內添加項目(圖表類型)
With List1
.AddItem "3維條形圖"
.AddItem "2維條形圖"
.AddItem "3維折線圖"
.AddItem "2維折線圖"
.AddItem "3維域型圖"
.AddItem "2維域型圖"
.AddItem "3維階梯圖"
.AddItem "2維階梯圖"
.AddItem "3維聯合圖"
.AddItem "2維聯合圖"
.AddItem "2維餅形圖"
.AddItem "2維坐標圖"
End With
List1.Text = "2維條形圖" '缺省的圖表類型
Label2.Caption = "2維條形圖"
End Sub
'在標簽內列出圖表的類型
Private Sub List1_Click()
Select Case List1.Text
Case "3維條形圖"
Label2.Caption = "3維條形圖"
Me.Caption = "3維條形圖"
MSChart1.chartType = 0
Case "2維條形圖"
Label2.Caption = "2維條形圖"
Me.Caption = "2維條形圖"
MSChart1.chartType = 1
Case "3維折線圖"
Label2.Caption = "3維折線圖"
Me.Caption = "3維折線圖"
MSChart1.chartType = 2
Case "2維折線圖"
Label2.Caption = "2維折線圖"
Me.Caption = "2維折線圖"
MSChart1.chartType = 3
Case "3維域型圖"
Label2.Caption = "3維域型圖"
Me.Caption = "3維域型圖"
MSChart1.chartType = 4
Case "2維域型圖"
Label2.Caption = "2維域型圖"
Me.Caption = "2維域型圖"
MSChart1.chartType = 5
Case "3維階梯圖"
Label2.Caption = "3維階梯圖"
Me.Caption = "3維階梯圖"
MSChart1.chartType = 6
Case "2維階梯圖"
Label2.Caption = "2維階梯圖"
Me.Caption = "2維階梯圖"
MSChart1.chartType = 7
Case "3維聯合圖"
Label2.Caption = "3維聯合圖"
Me.Caption = "3維聯合圖"
MSChart1.chartType = 8
Case "2維聯合圖"
Label2.Caption = "2維聯合圖"
Me.Caption = "2維聯合圖"
MSChart1.chartType = 9
Case "2維餅形圖"
Label2.Caption = "2維餅形圖"
Me.Caption = "2維餅形圖"
MSChart1.chartType = 14
Case "2維坐標圖"
Label2.Caption = "2維坐標圖"
Me.Caption = "2維坐標圖"
MSChart1.chartType = 16
End Select
End Sub
'確定
Private Sub cmdOK_Click()
Label1.Visible = False
Label2.Visible = False
List1.Visible = False
cmdDraw.Visible = True
MSChart1.Visible = True
cmdOK.Visible = False
Me.Height = 8775 '展開窗體時,窗體的高度
Me.Width = 10635 '展開窗體時,窗體的寬度
End Sub
'作圖
Private Sub cmdDraw_Click()
cmdDraw.Visible = False
Label1.Visible = False '隱藏說明標簽
Label2.Visible = False '隱藏形式圖表類型標簽
List1.Visible = False '隱藏組合框
intFileNumber = FreeFile '取得空閑的文件號碼
Open strFileName For Input As intFileNumber
Input #intFileNumber, strData '讀列數
intCol = Val(strData) '取得列數
If intCol >= 2 Then
For intI = 2 To intCol '空轉,讀*****
Input #intFileNumber, strData
Next intI
End If
Input #intFileNumber, strData '讀行數
intRow = Val(strData) '取得行數
If intCol >= 2 Then
For intI = 2 To intCol '空轉,讀*****
Input #intFileNumber, strData
Next intI
End If
Input #intFileNumber, strData '讀總行數
intRowAll = Val(strData) '取得總行數
If intCol >= 2 Then
For intI = 2 To intCol '空轉,讀*****
Input #intFileNumber, strData
Next intI
End If
blnTitle = False: blnRowLabel = False: blnColLabel = False
'優先考慮圖題
If intRowAll > intRow + 3 Then blnTitle = True '有圖題
'其次考慮行標
If intRowAll > 2 * intRow + 3 Then blnRowLabel = True '有行標
'最后考慮列標
If intRowAll > 2 * intRow + 4 Then blnColLabel = True '有列標
'設置圖表控件屬性
With MSChart1
.RowCount = intRow '數據行數
If blnRowLabel Then .RowLabelCount = intRow '數據行標數
.ColumnCount = intCol '數據列數
If blnColLabel Then .ColumnLabelCount = intCol '數據列標數
.AutoIncrement = True '數據點可以遞增輸入
.ShowLegend = True '顯示圖例
End With
If blnTitle Then
Input #intFileNumber, strData '讀圖形標題
MSChart1.TitleText = strData '圖形標題
If intCol >= 2 Then
For intI = 2 To intCol '空轉,讀*****號
Input #intFileNumber, strData
Next intI
End If
End If
If blnRowLabel Then
For intI = 1 To intRow
MSChart1.Row = intI
Input #intFileNumber, strData '讀行標題
MSChart1.RowLabel = strData '行標題
If intCol >= 2 Then
For intJ = 2 To intCol '空轉,讀*****號
Input #intFileNumber, strData
Next intJ
End If
Next intI
End If
If blnColLabel Then
For intI = 1 To intCol '讀列標題
Input #intFileNumber, strData
MSChart1.Column = intI
MSChart1.ColumnLabel = strData
Next intI
End If
'作圖表
For intI = 1 To intRow
For intJ = 1 To intCol
Input #intFileNumber, strData '讀數據
dblData = Val(strData)
MSChart1.DataGrid.SetData intI, intJ, dblData, False
Next intJ
Next intI
Close
End Sub
'退出
Private Sub cmdExit_Click()
Unload Me
End
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -