C sharp读取DXF文件.doc
文本预览下载声明
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;
using System.Collections;
namespace DXF
{
public partial class Form1 : Form
{
private FileStream fs;
private StreamReader sr;
private ArrayList LayerList = new ArrayList();
private ArrayList LineList = new ArrayList();
private ArrayList ArcList=new ArrayList();
private ArrayList EllipseList = new ArrayList();
private ArrayList LwopolylineList = new ArrayList();
private ArrayList SplineList=new ArrayList();
private string[] str = new string[2];
private int count;
private double leftx;
private double lefty;
private double rightx;
private double righty;
public Form1()
{
InitializeComponent();
}
private string[] ReadPair()
{
string code = sr.ReadLine().Trim();
string codedata = sr.ReadLine().Trim();
count += 2;
string[] result = new string[2] { code, codedata };
return result;
}
private void Read()
{
while (sr.Peek() != -1)
{
str = ReadPair();
if (str[1] == SECTION)
{
str = ReadPair();
switch (str[1])
{
case HEADER: ReadHeader();
break;
case TABLES: ReadTable();
break;
case ENTITIES: ReadEntities();
break;
}
}
}
sr.Close();
fs.Close();
btDraw.Enabled = true;
label1.Text = count.ToString();
count = 0;
}
private void ReadTable()
{
显示全部