sharealex
sharealex
采纳率0%
2015-10-04 03:09

【AE开发初学】问题好多啊

加星号的部分都是报错的
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

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

    private void Form1_Load(object sender, EventArgs e)
    {

    }

    private void loadmap_Click(object sender, EventArgs e)//加载地图文档
    {
        **openFileDialog1**.Filter = "地图文档(.mxd)|*.mxd";
        openFileDialog1.ShowDialog();
        string pFileName = openFileDialog1.FileName;
        axMapControl1.LoadMxFile(pFileName);
        axMapControl2.LoadMxFile(pFileName);
        axMapControl2.Extent = axMapControl2.FullExtent;
        axMapControl1.Extent = axMapControl1.FullExtent;
    }

    private void loadlayer_Click(object sender, EventArgs e)//加载图层文件
    {
        openFileDialog1.Filter = "图层文件(.lyr)|*.lyr";
        openFileDialog1.ShowDialog();
        string pFileName = openFileDialog1.FileName;
        axMapControl1.AddLayerFromFile(pFileName);
        axMapControl1.ActiveView.Refresh();
    }


    private void magnify_Click(object sender, EventArgs e)//中心放大
    {
        **IEnvelop** pEnv;
        pEnv = axMapControl1.Extent;
        pEnv.Expand(0.5, 0.5, true);
        axMapControl1.Extent = pEnv;
    }

    private void shrink_Click(object sender, EventArgs e)//中心缩小
    {

        IEnvelop pEnv;
        pEnv = axMapControl1.Extent;
        pEnv.Expand(2, 2, true);
        axMapControl1.Extent = pEnv;
    }

    private void wander_Click(object sender, EventArgs e)//漫游
    {
        if (e.button == 1)
        {
            IEnvelope pEnv;
            pEnv = axMapControl1.TrackRectangle();
            axMapControl1.Extent = pEnv;
        }
        else if (e.button == 2)
        { axMapControl1.Pan(); }
    }

    private void fullscreen_Click(object sender, EventArgs e)//全图显示
    {
        axMapControl1.Extent = axMapControl1.FullExtent;
    }

    private void back_Click(object sender, EventArgs e)//视图回退
    {
        IExtentStack pExt;
        pExt = axMapControl1.ActiveView.ExtentStack;
        if (pExt.CanUndo())
        { pExt.Undo(); }
    }

    private void cancelback_Click(object sender, EventArgs e)//取消回退
    {
        **IExtentStack** pExt;
        pExt = axMapControl1.ActiveView.ExtentStack;
        if (pExt.CanRedo())
        { pExt.Redo(); }
    }

    private void loadshp_Click(object sender, EventArgs e)//加载SHP文件
    {
        openFileDialog1.Filter = "SHP文件(.shp)|*.shp";
        openFileDialog1.ShowDialog();
        string pFileName = openFileDialog1.FileName;
        if (strFileName == string.Empty)
            return;
        String pathName = System.IO.Path.GetDirectoryName(strFileName);
        string fileName = System.IO.Path.GetFileNameWithoutExtension(strFileName);
        axMapControl1.AddShapeFile(pathName, fileName);
    }

    private void delete_Click(object sender, EventArgs e)//删除指定图层
    {

    }

    private void clear_Click(object sender, EventArgs e)//清除所有图层
    {

    }


}

}
界面图
引用

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • sharealex sharealex 6年前

    openFileDialog1
    IEnvelop
    IExtentStack出错

    点赞 评论 复制链接分享

相关推荐