private void autoLabel(string layerName)
{
MapXLib.Layer layer=axMap1.Layers._Item(layerName);
MapXLib.Dataset ds=axMap1.DataSets._Item("ds"+layerName);
layer.LabelProperties.Dataset =ds;
layer.LabelProperties.DataField =ds.Fields._Item("name");
layer.LabelProperties.Position=MapXLib.PositionConstants.miPositionBC;
layer.LabelProperties.Style.TextFont.Size=10;
layer.LabelProperties.Offset=4;
layer.AutoLabel =true;
}
错误 1 应输入 class、delegate、enum、interface 或 struct D:\GIS开发与应用\示例程序\C#\WindowsFormsApplication2\WindowsFormsApplication2\Form1.cs 43 9 WindowsFormsApplication2
你好,这是我从教材上拷贝下来的代码,我没有写在任何类的"{}"中
提示问题出在“ private void autoLabel(string layerName)"这一行,void被标注红色波浪线,提示如上问题,
你这段代码是在哪个类下面?比如
private class Test
{
private void autoLabel(string layerName)
{
}
}
这样才行!
private class Test
{
}
private void autoLabel(string layerName){}
这样就会出现你所遇见的错误!