一.弹框显示图层数据
private ToolStripStatusLabel statusStrip1 = new ToolStripStatusLabel();
private ToolStripStatusLabel m_label = null;
public Form1()
{
InitializeComponent();
ShowAttributes(axMap1, @"", statusStrip1);
}
public void ShowAttributes(AxMap axMap1, string dataPath, ToolStripStatusLabel label)
{
axMap1.Projection = tkMapProjection.PROJECTION_WGS84;
string filename = dataPath + "tantou5.shp";
Shapefile sf = new Shapefile();
if (sf.Open(filename))
{
int m_layerHandle = axMap1.AddLayer(sf, true);
sf = axMap1.get_Shapefile(m_layerHandle);
//
if (!sf.Table.StartEditingTable(null))
{
MessageBox.Show("无法打开编辑模式" + sf.Table.ErrorMsg[sf.LastErrorCode]);
}
else
{
////提示框
//string expression = "";
//for (int i = 0; i < sf.NumFields; i++)
//{
// expression += "[" + sf.Field[i].Name + "]";
// if (i != sf.NumFields - 1)
// {
// const string endLine = "\"\n\"";
// expression += string.Format("+ {0} +", endLine);
// }
//}
//sf.Labels.Generate(expression, tkLabelPositioning.lpCentroid, false);
sf.Labels.TextRenderingHint = tkTextRenderingHint.SystemDefault;
axMap1.SendMouseDown = true;
axMap1.CursorMode = tkCursorMode.cmIdentify;
axMap1.ShapeIdentified += A

本文介绍了一种在地图应用中通过弹窗显示图层属性数据的方法,并提供了一个使用 TextBox 控件来显示图层属性信息的简化示例。
最低0.47元/天 解锁文章
627

被折叠的 条评论
为什么被折叠?



