基本信息
源码名称:C# DataViewer3dlib
源码大小:0.15M
文件格式:.rar
开发语言:C#
更新时间:2019-01-19
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍
359307355DataViewer3dlib


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;


namespace test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitlizeControl();
        }

        //自定义控件初始化
        private void InitlizeControl()
        {
            dataViewer3d1.ForeColor = Color.Blue;
            //dataViewer3d1.Height = 10;
        }

        private void ButtonRead_Click(object sender, EventArgs e)
        {
            
            
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();
            openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
            openFileDialog1.FilterIndex = 1;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (openFileDialog1.FileName!= null)
                {
                    // Insert code to read the stream here.
                    StreamReader dataStream;
                    dataStream = new StreamReader(openFileDialog1.FileName);                    
                    string text_line;
                    string[] text_words;
                    double pointx, pointy, pointz;
                    
                    while((text_line=dataStream.ReadLine())!=null)
                    {
                        text_words = text_line.Split(',');
                        pointx = Convert.ToDouble(text_words[0]);
                        pointy = Convert.ToDouble(text_words[1]);
                        pointz = Convert.ToDouble(text_words[2]);
                        dataViewer3d1.PointX.Add(pointx);
                        dataViewer3d1.PointY.Add(pointy);
                        dataViewer3d1.PointZ.Add(pointz);
                    }                     
                    dataStream.Close();
                    dataViewer3d1.PrepareData();
                }
            }            
        }

        private void dataViewer3d1_Load(object sender, EventArgs e)
        {

        }
    }
}