用arcgis engine 及c#开发时 使用ControlsSynchronizer需要引用什么?
namespace_dnMap1{publicpartialclassForm1:Form{privateESRI.ArcGIS.Controls.IMapControl...
namespace _dnMap1
{
public partial class Form1 : Form
{
private ESRI.ArcGIS.Controls.IMapControl3 m_mapControl = null;
private ESRI.ArcGIS.Controls.IPageLayoutControl2 m_pageLayoutControl = null;
private IMapDocument pMapDocument;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
m_mapControl = (IMapControl3)this.axMapControl1.Object;
m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
}
private void New_Click(object sender, EventArgs e)
{
}
private void AddData_Click(object sender, EventArgs e)
{
int currentLayerCount = this.axMapControl1.LayerCount;
ICommand pCommand = new ControlsAddDataCommandClass();
pCommand.OnCreate(this.axMapControl1.Object);
pCommand.OnClick();
}
private void Save_Click(object sender, EventArgs e)
{
if (null != m_pageLayoutControl.DocumentFilename && m_mapControl.CheckMxFile(m_pageLayoutControl.DocumentFilename))
{
IMapDocument mapDoc = new MapDocumentClass();
mapDoc.Open(m_pageLayoutControl.DocumentFilename, string.Empty);
mapDoc.ReplaceContents((IMxdContents)m_pageLayoutControl.PageLayout);
mapDoc.Save(mapDoc.UsesRelativePaths, false);
mapDoc.Close();
}
}
private void SaveAs_Click(object sender, EventArgs e)
{
ICommand command = new ControlsSaveAsDocCommandClass();
command.OnCreate(m_controlsSynchronizer.ActiveControl);
command.OnClick();
}
private void Exit_Click(object sender, EventArgs e)
{
Application.Exit();
}每次运行它总提示错为:当前上下问不存在m_controlsSynchronizer
请教高人 我是不是缺少什么引用啊 展开
{
public partial class Form1 : Form
{
private ESRI.ArcGIS.Controls.IMapControl3 m_mapControl = null;
private ESRI.ArcGIS.Controls.IPageLayoutControl2 m_pageLayoutControl = null;
private IMapDocument pMapDocument;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
m_mapControl = (IMapControl3)this.axMapControl1.Object;
m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;
}
private void New_Click(object sender, EventArgs e)
{
}
private void AddData_Click(object sender, EventArgs e)
{
int currentLayerCount = this.axMapControl1.LayerCount;
ICommand pCommand = new ControlsAddDataCommandClass();
pCommand.OnCreate(this.axMapControl1.Object);
pCommand.OnClick();
}
private void Save_Click(object sender, EventArgs e)
{
if (null != m_pageLayoutControl.DocumentFilename && m_mapControl.CheckMxFile(m_pageLayoutControl.DocumentFilename))
{
IMapDocument mapDoc = new MapDocumentClass();
mapDoc.Open(m_pageLayoutControl.DocumentFilename, string.Empty);
mapDoc.ReplaceContents((IMxdContents)m_pageLayoutControl.PageLayout);
mapDoc.Save(mapDoc.UsesRelativePaths, false);
mapDoc.Close();
}
}
private void SaveAs_Click(object sender, EventArgs e)
{
ICommand command = new ControlsSaveAsDocCommandClass();
command.OnCreate(m_controlsSynchronizer.ActiveControl);
command.OnClick();
}
private void Exit_Click(object sender, EventArgs e)
{
Application.Exit();
}每次运行它总提示错为:当前上下问不存在m_controlsSynchronizer
请教高人 我是不是缺少什么引用啊 展开
2个回答
展开全部
我想你用的是ARCGIS Engine开发帮助sample的一个例子代码
这里m_controlsSynchronizer是ControlsSynchronizer类的一个实例对象
你没有对 m_controlsSynchronizer进行定义
在这里你需要引用ControlsSynchronizer这个类
然后定义就可以了
不过建议你好好看看 这个例子
C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\Engine\MapAndPageLayoutSynchApp
这个里面就有ControlsSynchronizer这个类
这里m_controlsSynchronizer是ControlsSynchronizer类的一个实例对象
你没有对 m_controlsSynchronizer进行定义
在这里你需要引用ControlsSynchronizer这个类
然后定义就可以了
不过建议你好好看看 这个例子
C:\Program Files\ArcGIS\DeveloperKit\SamplesNET\Engine\MapAndPageLayoutSynchApp
这个里面就有ControlsSynchronizer这个类
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询