⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmchart.frm

📁 用VB6.0编写的关于车辆运输调度的系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{B02F3647-766B-11CE-AF28-C3A2FBE76A13}#2.5#0"; "SS32X25.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmchart 
   Caption         =   "The report of tank actual level"
   ClientHeight    =   8595
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9780
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   9
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   8595
   ScaleWidth      =   9780
   WindowState     =   2  'Maximized
   Begin VB.Frame Frame1 
      Height          =   2775
      Left            =   120
      TabIndex        =   10
      Top             =   0
      Width           =   6375
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   13
         Top             =   1080
         Width           =   1575
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   3840
         Style           =   2  'Dropdown List
         TabIndex        =   12
         Top             =   1080
         Width           =   1575
      End
      Begin VB.ComboBox Combo3 
         Height          =   300
         Left            =   960
         Style           =   2  'Dropdown List
         TabIndex        =   11
         Top             =   1920
         Width           =   1575
      End
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   375
         Left            =   3840
         TabIndex        =   14
         Top             =   240
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Format          =   24707073
         CurrentDate     =   37138
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   375
         Left            =   960
         TabIndex        =   15
         Top             =   240
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   661
         _Version        =   393216
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Format          =   24707073
         CurrentDate     =   37138
      End
      Begin VB.Label Label1 
         Caption         =   "Cudtomer Code:"
         Height          =   375
         Left            =   3000
         TabIndex        =   20
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "Tank Code:"
         Height          =   375
         Left            =   240
         TabIndex        =   19
         Top             =   1800
         Width           =   495
      End
      Begin VB.Label Label3 
         Caption         =   "From:"
         Height          =   255
         Left            =   360
         TabIndex        =   18
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label4 
         Caption         =   "To:"
         Height          =   255
         Left            =   3480
         TabIndex        =   17
         Top             =   360
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "Product Code:"
         Height          =   375
         Left            =   120
         TabIndex        =   16
         Top             =   960
         Width           =   615
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Exit"
      Height          =   375
      Left            =   6840
      TabIndex        =   9
      Top             =   5280
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   315
      Left            =   5040
      TabIndex        =   8
      Top             =   5280
      Width           =   1335
   End
   Begin VB.TextBox Text2 
      Height          =   315
      Left            =   2880
      TabIndex        =   6
      Top             =   5280
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Height          =   315
      Left            =   720
      TabIndex        =   4
      Top             =   5280
      Width           =   1335
   End
   Begin VB.CommandButton Cmd_exchange 
      Caption         =   "Exchange"
      Height          =   375
      Left            =   6840
      TabIndex        =   2
      Top             =   3720
      Width           =   1215
   End
   Begin FPSpread.vaSpread vasReport 
      Height          =   2055
      Left            =   120
      TabIndex        =   1
      Top             =   3000
      Width           =   6375
      _Version        =   131077
      _ExtentX        =   11245
      _ExtentY        =   3625
      _StockProps     =   64
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MaxCols         =   1
      MaxRows         =   1
      SpreadDesigner  =   "Frmchart.frx":0000
   End
   Begin VB.CommandButton Cmd_ok 
      Caption         =   "O K"
      Height          =   375
      Left            =   6840
      TabIndex        =   0
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label8 
      Caption         =   "Safe Level:"
      Height          =   375
      Left            =   4440
      TabIndex        =   7
      Top             =   5280
      Width           =   495
   End
   Begin VB.Label Label7 
      Caption         =   "Min Level:"
      Height          =   375
      Left            =   2280
      TabIndex        =   5
      Top             =   5280
      Width           =   495
   End
   Begin VB.Label Label6 
      Caption         =   "Max Level:"
      Height          =   375
      Left            =   120
      TabIndex        =   3
      Top             =   5280
      Width           =   495
   End
End
Attribute VB_Name = "frmchart"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Base 1

Private acs_rec As Recordset
Private sta As Integer
Private Enum iltank
        Date = 1
        Inventory
        
End Enum

Private Sub Cmd_exchange_Click()

    Call CreateExcelFile
    
End Sub

Private Sub CreateExcelFile()
On Error Resume Next
    Dim n As Integer
    Dim objexcel As Excel.Application
    Dim objwork As Excel.Workbook
'    Dim objsheet As Excel.Worksheet
'    Dim objchart As Excel.Chart
    Dim objrange As Excel.Range
    Dim DataArray() As Variant
    ReDim DataArray(vasReport.MaxRows, vasReport.MaxCols)
    
    DataToArray DataArray
    
    Set objexcel = New Excel.Application
    objexcel.Workbooks.Add
    Set objwork = objexcel.ActiveWorkbook
    Set objsheet = objwork.Worksheets(1)
    Set objrange = objwork.ActiveSheet.Range(objwork.ActiveSheet.Cells(2, 1), objwork.ActiveSheet.Cells(vasReport.MaxRows + 1, vasReport.MaxCols))
    objrange.Value = DataArray
    For n = 1 To vasReport.MaxCols
        objrange.Columns(n).AutoFit
    Next n
    
    objwork.ActiveSheet.Range(objwork.ActiveSheet.Cells(2, 1), objwork.ActiveSheet.Cells(vasReport.MaxRows + 1, vasReport.MaxCols)).Select
    objwork.Charts.Add
    
    objwork.ActiveChart.ChartType = xlLine
    objwork.ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range(objwork.ActiveSheet.Cells(2, 2), objwork.ActiveSheet.Cells(vasReport.MaxRows + 1, vasReport.MaxCols)), PlotBy:= _
        xlColumns
    objwork.ActiveChart.SeriesCollection(1).name = "=""Actual Level"""
    objwork.ActiveChart.SeriesCollection(2).name = "=""Safe Level"""
    objwork.ActiveChart.SeriesCollection(3).name = "=""Max Level"""
    objwork.ActiveChart.SeriesCollection(4).name = "=""Min Level"""
    objwork.ActiveChart.Location Where:=xlLocationAsNewSheet, name:="Chart 1"
    With objwork.ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.Text = "Actual level"
        .Axes(xlCategory, xlPrimary).HasTitle = False
        .Axes(xlValue, xlPrimary).HasTitle = False
    End With
    objwork.ActiveChart.HasDataTable = True
    objwork.ActiveChart.DataTable.ShowLegendKey = False
    
    objwork.ActiveChart.ChartTitle.Select

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -