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

📄 form1.frm

📁 VC实现等值线编成的COM组件的源程序代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   3990
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5040
   LinkTopic       =   "Form1"
   ScaleHeight     =   3990
   ScaleWidth      =   5040
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Picture1 
      Height          =   2895
      Left            =   120
      ScaleHeight     =   2835
      ScaleWidth      =   4755
      TabIndex        =   2
      Top             =   960
      Width           =   4815
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Command1"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   480
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   120
      TabIndex        =   0
      Text            =   "sample.dat"
      Top             =   120
      Width           =   4695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim contour As New COM_EXLib.contour
    Dim concount As Long, segcount As Long, pointcount As Long
    Dim x() As Double, y() As Double
    Dim xmin As Double, xmax As Double, ymin As Double, ymax As Double
    Dim i, j, tmpx, tmpy, tmpz
    
    '打开数据文件,获取数据的范围
    Open Text1.Text For Input As #1
        Input #1, tmpx, tmpy, tmpz
        xmax = tmpx
        xmin = tmpx
        ymax = tmpy
        ymin = tmpy
        Do While Not EOF(1)
            Input #1, tmpx, tmpy, tmpz
            If tmpx > xmax Then xmax = tmpx
            If tmpx < xmin Then xmin = tmpx
            If tmpy > ymax Then ymax = tmpy
            If tmpy < ymin Then ymin = tmpy
        Loop
    Close #1
    
    '根据数据范围设置picturebox的坐标
    Picture1.ScaleLeft = xmin
    Picture1.ScaleWidth = xmax - xmin
    Picture1.ScaleTop = ymax
    Picture1.ScaleHeight = -(ymax - ymin)
    
    '生成等值线并绘图
    contour.InitialContour (Text1.Text)
    concount = contour.GetContourCount
    For i = 0 To concount - 1
        segcount = contour.GetSegCountOf(i)
        For j = 0 To segcount - 1
            pointcount = contour.GetPointsCountOf(i, j)
            ReDim x(pointcount)
            ReDim y(pointcount)
            contour.GetPointsOf i, j, x(0), y(0)
            For k = 0 To pointcount - 2
                Picture1.Line (x(k), y(k))-(x(k + 1), y(k + 1))
            Next k
        Next j
    Next i
    Set contour = Nothing
End Sub

⌨️ 快捷键说明

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