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

📄 chartscr.ctl

📁 物流管理系统实例程序
💻 CTL
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.UserControl UChart 
   ClientHeight    =   4500
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6915
   ScaleHeight     =   4500
   ScaleWidth      =   6915
   Begin VB.HScrollBar HScroll1 
      Height          =   255
      LargeChange     =   2000
      Left            =   0
      SmallChange     =   200
      TabIndex        =   2
      Top             =   4200
      Width           =   6855
   End
   Begin VB.ComboBox cboTy 
      Height          =   300
      ItemData        =   "ChartScr.ctx":0000
      Left            =   885
      List            =   "ChartScr.ctx":0010
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   120
      Width           =   1335
   End
   Begin VB.ComboBox cboBl 
      Height          =   300
      ItemData        =   "ChartScr.ctx":0044
      Left            =   3165
      List            =   "ChartScr.ctx":005A
      Style           =   2  'Dropdown List
      TabIndex        =   0
      Top             =   120
      Width           =   1335
   End
   Begin MSChart20Lib.MSChart MSChart1 
      Height          =   4095
      Left            =   45
      OleObjectBlob   =   "ChartScr.ctx":007C
      TabIndex        =   3
      Top             =   360
      Width           =   6855
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "图样:"
      Height          =   180
      Left            =   405
      TabIndex        =   5
      Top             =   120
      Width           =   450
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "横向比:"
      Height          =   180
      Left            =   2445
      TabIndex        =   4
      Top             =   120
      Width           =   630
   End
End
Attribute VB_Name = "UChart"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Dim intBl As Integer
Public Enum mBorderStyle
   '枚举边框数据类型
   None
   FixedSingle
End Enum

Public Property Get Data() As String
Attribute Data.VB_Description = "返回/设置数据网格中由 Column 和 Row 标识的指定数据点的值。"
    Data = MSChart1.Data
End Property

Public Property Let Data(ByVal New_Data As String)
    MSChart1.Data = New_Data
    PropertyChanged "Data"
End Property

Public Property Get Column() As Integer
Attribute Column.VB_Description = "返回/设置数据网格的活动列。"
    Column = MSChart1.Column
End Property

Public Property Let Column(ByVal New_Column As Integer)
    MSChart1.Column() = New_Column
    PropertyChanged "Column"
End Property

Public Property Get ColumnCount() As Integer
Attribute ColumnCount.VB_Description = "返回/设置数据网格的列数。"
    ColumnCount = MSChart1.ColumnCount
End Property

Public Property Let ColumnCount(ByVal New_ColumnCount As Integer)
    MSChart1.ColumnCount() = New_ColumnCount
    PropertyChanged "ColumnCount"
End Property

Public Property Get Row() As Integer
Attribute Row.VB_Description = "返回/设置数据网格活动行。"
    Row = MSChart1.Row
End Property

Public Property Let Row(ByVal New_Row As Integer)
    MSChart1.Row() = New_Row
    PropertyChanged "Row"
End Property

Public Property Get RowCount() As Integer
Attribute RowCount.VB_Description = "返回/设置数据网格的行数。"
    RowCount = MSChart1.RowCount
End Property

Public Property Let RowCount(ByVal New_RowCount As Integer)
    MSChart1.RowCount() = New_RowCount
    PropertyChanged "RowCount"
End Property

Public Property Get BorderStyle() As mBorderStyle
    BorderStyle = UserControl.BorderStyle
End Property

Public Property Let BorderStyle(ByVal New_BorderStyle As mBorderStyle)
    UserControl.BorderStyle() = New_BorderStyle
    PropertyChanged "BorderStyle"
End Property

Private Sub cboTy_Click()
    '选择统计图样
    Select Case cboTy.ListIndex
        Case 0
            MSChart1.chartType = VtChChartType2dBar
            cboBl.Enabled = True
        Case 1
            MSChart1.chartType = VtChChartType2dLine
            cboBl.Enabled = True
        Case 2
            MSChart1.chartType = VtChChartType3dBar
            cboBl.ListIndex = 0
            cboBl.Enabled = False
        Case 3
            MSChart1.chartType = VtChChartType3dLine
            cboBl.ListIndex = 0
            cboBl.Enabled = False
    End Select
End Sub

Private Sub UserControl_Initialize()
    '初始子控件属性值
    cboTy.ListIndex = 0
    cboBl.ListIndex = 0
End Sub

'从存贮器中加载属性值
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    MSChart1.Data = PropBag.ReadProperty("Data", "41")
    MSChart1.Column = PropBag.ReadProperty("Column", 1)
    MSChart1.ColumnCount = PropBag.ReadProperty("ColumnCount", 4)
    MSChart1.Row = PropBag.ReadProperty("Row", 1)
    MSChart1.RowCount = PropBag.ReadProperty("RowCount", 5)
    UserControl.BorderStyle = PropBag.ReadProperty("BorderStyle", 1)
End Sub

Private Sub UserControl_Resize()
    HScroll1.Move 0, Height - 320, Width - 60, 260
    ReChartSize
End Sub

'将属性值写到存储器
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    Call PropBag.WriteProperty("Data", MSChart1.Data, "41")
    Call PropBag.WriteProperty("Column", MSChart1.Column, 1)
    Call PropBag.WriteProperty("ColumnCount", MSChart1.ColumnCount, 4)
    Call PropBag.WriteProperty("Row", MSChart1.Row, 1)
    Call PropBag.WriteProperty("RowCount", MSChart1.RowCount, 5)
    Call PropBag.WriteProperty("BorderStyle", BorderStyle, 1)
End Sub

Private Sub HScroll1_Change()
    '通过横向滑块控制统计图位置
    MSChart1.Left = -HScroll1.Value
End Sub

Private Sub cboBl_Click()
    intBl = cboBl.ListIndex + 1
    ReChartSize
End Sub

Private Sub ReChartSize()
    If intBl = 1 Then
        HScroll1.Visible = False
        MSChart1.Move 0, 360, Width * intBl, Height - 360
    Else
        HScroll1.Visible = True
        MSChart1.Move 0, 360, Width * intBl, Height - 600
    End If
    HScroll1.Max = MSChart1.Width - HScroll1.Width
End Sub

Public Sub ChartData(CDatas() As Variant)
    '给统计图装载数据
    MSChart1.ChartData = CDatas
End Sub

⌨️ 快捷键说明

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