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

📄

📁 模糊数学基础及实用算法 (源码) 科学出版社 www.sciencep.com
💻
字号:
VERSION 5.00
Begin VB.Form frmText 
   Appearance      =   0  'Flat
   BackColor       =   &H80000005&
   Caption         =   "在空白文本框内录入数据"
   ClientHeight    =   8430
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12750
   LinkTopic       =   "Form1"
   ScaleHeight     =   8430
   ScaleWidth      =   12750
   Begin VB.TextBox txtCol 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   0
      Left            =   720
      TabIndex        =   5
      Top             =   240
      Width           =   735
   End
   Begin VB.TextBox txtRow 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   0
      Left            =   0
      TabIndex        =   4
      Top             =   480
      Width           =   735
   End
   Begin VB.CommandButton cmdExit 
      Cancel          =   -1  'True
      Caption         =   "退出"
      Height          =   255
      Left            =   1440
      TabIndex        =   3
      TabStop         =   0   'False
      ToolTipText     =   "结束程序运行"
      Top             =   0
      Width           =   735
   End
   Begin VB.CommandButton cmdPrint 
      Caption         =   "打印"
      Height          =   255
      Left            =   720
      TabIndex        =   2
      TabStop         =   0   'False
      ToolTipText     =   "打印机打印录入数据"
      Top             =   0
      Width           =   735
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存"
      Height          =   255
      Left            =   0
      TabIndex        =   1
      TabStop         =   0   'False
      ToolTipText     =   "将录入数据保存到数据文件"
      Top             =   0
      Width           =   855
   End
   Begin VB.TextBox txtInput 
      Appearance      =   0  'Flat
      Height          =   270
      Index           =   0
      Left            =   720
      TabIndex        =   0
      Top             =   480
      Width           =   735
   End
End
Attribute VB_Name = "frmText"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'文本框数组录入窗体
Option Explicit
Dim sngtxtHig As Single, sngtxtWid As Single
Dim snglblHig As Single, snglblWid As Single
Dim intI As Integer, intJ As Integer

Private Sub Form_Load()
    Dim intRowStart As Integer
    Me.Height = Screen.Height
    Me.Width = Screen.Width
'使设计时安置在窗体的原型控件不可见
    txtInput(0).Visible = False
    txtRow(0).Visible = False
    txtCol(0).Visible = False
'利用原型控件的坐标参数
    sngtxtHig = txtInput(0).Height
    sngtxtWid = txtInput(0).Width
    snglblHig = sngtxtHig                   '原型控件的高度
    snglblWid = sngtxtWid                   '原型控件的宽度
'形成录入数据用的文本框数组
    For intI = 1 To intRow
        For intJ = 1 To intCol
            Load txtInput((intI - 1) * intCol + intJ)
            txtInput((intI - 1) * intCol + intJ).Move _
                             txtInput(0).Left + (intJ - 1) * sngtxtWid, _
                             txtInput(0).Top + (intI - 1) * sngtxtHig
            txtInput((intI - 1) * intCol + intJ).Visible = True
            txtInput((intI - 1) * intCol + intJ).Text = ""
        Next intJ
    Next intI
'形成左边文本框数组,对行作标记
    For intI = 1 To intRow
        Load txtRow(intI)
        txtRow(intI).Move txtRow(0).Left, _
            txtRow(0).Top + (intI - 1) * sngtxtHig
        txtRow(intI).Visible = True
        txtRow(intI).Text = "第" & intI & "行"
    Next intI
'形成上边文本框数组,对列作标记
    For intI = 1 To intCol
        Load txtCol(intI)
        txtCol(intI).Move txtCol(0).Left + (intI - 1) * snglblWid, _
                          txtCol(0).Top
        txtCol(intI).Visible = True
        txtCol(intI).Text = "第" & intI & "列"
    Next intI
End Sub

'打印
Private Sub cmdPrint_Click()
    Dim intI1 As Integer, intI2 As Integer
    intI1 = 1: intI2 = 8
    If intCol <= 8 Then intI2 = intCol
AA1:
    Printer.Print ,
    For intI = intI1 To intI2
        Printer.Print txtCol(intI).Text,    '打印列标记
    Next intI
    For intI = 1 To intRow
        Printer.Print
        Printer.Print txtRow(intI).Text,    '打印行标记
        For intJ = intI1 To intI2
'打印数据
            Printer.Print txtInput((intI - 1) * intCol + intJ).Text,
        Next intJ
    Next intI
    If intCol > 8 And intI2 <= 8 Then
        intI1 = intI1 + 8
        intI2 = intCol
        Printer.Print
        Printer.Print
        GoTo AA1
    End If
    Printer.EndDoc                          '执行打印
End Sub


'形成数组并保存为数据文件
Private Sub cmdSave_Click()
    Dim intFileNumber As Integer
    Dim vntA, strA As String
    MsgBox "开始保存数据,请耐心等待!"
    intFileNumber = FreeFile                        '取得空闲的文件号
    Open strFileName For Output As intFileNumber    '打开文件
    Write #intFileNumber, intRow; intCol            '保存行数和列数
    For intI = 1 To intRow
        For intJ = 1 To intCol
'将数组中的数据写到文件上
            vntA = txtInput((intI - 1) * intCol + intJ)
            If intJ <> intCol Then
                Write #intFileNumber, vntA;
            Else
                Write #intFileNumber, vntA
            End If
        Next intJ
    Next intI
'将上部的标签内容写到文件
    For intI = 1 To intCol
        strA = txtCol(intI).Text
        If intI <> intCol Then
            Write #intFileNumber, strA;
        Else
            Write #intFileNumber, strA
        End If
    Next intI
'将左边的标签内容写到文件
    For intI = 1 To intRow
        strA = txtRow(intI).Text
        If intI <> intRow Then
            Write #intFileNumber, strA;
        Else
            Write #intFileNumber, strA
        End If
    Next intI
    Close                                           '关闭文件
    cmdSave.Visible = False
    MsgBox "保存数据完成,请继续进行!"
End Sub

'退出
Private Sub cmdExit_Click()
    Unload Me
    End
End Sub





⌨️ 快捷键说明

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