Engine发教程 - 图文 下载本文

步骤一:添加一个Form,并添加4个Button,2个标签,2个文本框如下图所示:

2.6.2功能开发代码

private AxMapControl buddyMap;

///

/// 关联地图控件

///

public AxMapControl BuddyMap { get {

return buddyMap;

} set {

buddyMap = value; } }

///

/// 要保存的ShapeFile全路径名称

///

string shapeFileFullName = string.Empty;

///

/// 测量数据全路径名称

///

string surveyDataFullName = string.Empty;

List pColumns = new List();

List pCPointList = new List();

struct CPoint {

public double x;

public double y;

public string name; }

private void OpenBtn_Click(object sender, EventArgs e) {

OpenFileDialog pOFD = new OpenFileDialog();

pOFD.Multiselect = false;

pOFD.Title = \打开本地测量坐标文件\

pOFD.InitialDirectory = System.IO.Directory.GetCurrentDirectory();

pOFD.Filter = \测量坐标文件(*.TXT)|*.TXT\

if (pOFD.ShowDialog() == DialogResult.OK)

{

surveyDataFullName = pOFD.FileName;

this.textBox1.Text = surveyDataFullName; } }

private void Savebtn_Click(object sender, EventArgs e) {

SaveFileDialog saveFileDialog = new SaveFileDialog();

saveFileDialog.Filter = \文件(*.shp) |*.shp\

DialogResult dialogResult = saveFileDialog.ShowDialog();

if (dialogResult == DialogResult.OK) {

shapeFileFullName = saveFileDialog.FileName;

} else {

shapeFileFullName = null; return; }

this.textBox2.Text = shapeFileFullName;

}

///

/// 获取点数据

///

///

///

private List GetAllPoint(string surveyDataFullName) { try {

List pList = new List();

if (surveyDataFullName == null || surveyDataFullName == string.Empty) {

MessageBox.Show(\选择野外测量数据\