Form1.frm
资源名称:08.zip [点击查看]
上传用户:ynjin1970
上传日期:2014-10-13
资源大小:6438k
文件大小:3k
源码类别:
中间件编程
开发平台:
Visual C++
- 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