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

📄 ÷

📁 所有数理统计知识的源代码都在此,是一本数理统计数的配套光盘.里面有各种分布类型及参数估计插值
💻
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form frmPicture 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "曲线"
   ClientHeight    =   8085
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   14325
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   14.261
   ScaleMode       =   0  'User
   ScaleWidth      =   25.268
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdLittle 
      Caption         =   "1/2"
      Height          =   375
      Left            =   2520
      TabIndex        =   3
      Top             =   0
      Width           =   975
   End
   Begin VB.CommandButton cmdPrint 
      Caption         =   "打  印"
      Height          =   375
      Left            =   1680
      TabIndex        =   2
      Top             =   0
      Width           =   855
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退  出"
      Height          =   375
      Left            =   840
      TabIndex        =   1
      Top             =   0
      Width           =   855
   End
   Begin VB.CommandButton cmdDraw 
      Caption         =   "作  图"
      Height          =   375
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   855
   End
   Begin VB.Label lblTitle 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      Caption         =   "图题"
      DragMode        =   1  'Automatic
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   435
      Left            =   6960
      TabIndex        =   4
      Top             =   120
      Width           =   915
   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 blnTitle As Boolean                 '是否有图题
Dim blnRowLabel As Boolean              '是否有行标
Dim blnColLabel As Boolean              '是否有列标
Dim strColLabel() As String             '列标数组
Dim strRowLabel() As String             '行标数组
Dim dblData() As Double                 '图形数据
Dim sngData() As Single                 '变换为坐标值的图形数据
Dim dblDatMin() As Double               '极小值
Dim dblDatMax() As Double               '极大值
Dim dblMaxMin As Double                 '极差
Dim sngXInc As Single                   '水平方向的坐标增量
Dim sngYInc As Single                   '垂直方向的坐标增量
Dim sngH As Single                      '窗体自定义高度单位等价的Twips
Dim sngCH As Single                     '曲线的高度
Dim intYScale(1 To 4) As Integer        '纵轴的刻度值
Dim sngYScale(1 To 4) As Single         '纵轴刻度的坐标值
Dim intS As Integer, intS1 As Integer, intS2 As Integer

Private Sub Form_Load()
    lblTitle.Visible = False
    Me.Top = 0: Me.Left = 0
    intS1 = 17: intS2 = 12
    Me.Scale (0, 0)-(intS1, intS2)      '窗体的自定义坐标系
    sngH = Me.Height / 12
    cmdPrint.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
'重新定义图形数据数组
    ReDim dblData(1 To intRow, 1 To intCol)     '原始数据
    ReDim sngData(1 To intRow, 1 To intCol)     '变换成坐标后的数据
'重新定义每行的极值数组
    ReDim dblDatMin(1 To intRow), dblDatMax(1 To intRow)
'确定曲线高度
'行数=曲线条数
'sngH是自定义高度单位所相当的Twips数
    If intRow <= 3 Then
        sngCH = 3                       '曲线高度为3单位
    ElseIf intRow <= 6 Then
        sngCH = 1.5                     '曲线高度为1.5单位
    ElseIf intRow <= 9 Then
        sngCH = 1                       '曲线高度为1个单位
    ElseIf intRow <= 12 Then
        sngCH = 0.4                     '曲线的高度为0.8个单位
    Else
        MsgBox "行数小于1或行数大于12,无法作曲线图,请检查数据或开发新程序"
        Load Me
        End
    End If
    Me.Height = sngH * ((sngCH + 0.5) * intRow + 2)   '窗体的高度
    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                              '有行标
        ReDim strRowLabel(1 To intRow)                  '重新定义行标数组
    End If
'最后考虑列标
    If intRowAll > 2 * intRow + 4 Then
        blnColLabel = True                              '有列标
        ReDim strColLabel(1 To intCol)                  '重新定义列标数组
    End If
    If blnTitle Then
        lblTitle.Visible = True
        Input #intFileNumber, strData   '读图形标题
        lblTitle.Caption = strData      '在图题标签中显示图形标题
        lblTitle.Visible = True
        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
            Input #intFileNumber, strData               '读行标题
            strRowLabel(intI) = 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
            strColLabel(intI) = strData
        Next intI
    End If
    For intI = 1 To intRow
        For intJ = 1 To intCol
            Input #intFileNumber, strData               '读图形数据
            dblData(intI, intJ) = Val(strData)
        Next intJ
    Next intI
    Close
'列数=数据点个数
'sngXInc为水平方向的刻度间距
    If intCol > 1 Then
        sngXInc = 15 / (intCol - 1)
    Else
        MsgBox "列数不能小于等于1"
        Unload Me
        End
    End If
'求出每行数据的极值
    For intI = 1 To intRow
        dblDatMin(intI) = 100000

⌨️ 快捷键说明

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