vc转换成vb
publicvoidAddAccessDBByName(){IWorkspaceNamepWorkspaceName=newWorkspaceNameClass();pW...
public void AddAccessDBByName()
{
IWorkspaceName pWorkspaceName = new WorkspaceNameClass() ;
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory";
pWorkspaceName.PathName = @"D:\test\Ao\data\sh\MapData.mdb";
IName n = pWorkspaceName as IName ;
IFeatureWorkspace Workspace = n.Open() as IFeatureWorkspace;
IFeatureClass Fcls = Workspace.OpenFeatureClass ("District");
IFeatureLayer Fly = new FeatureLayerClass();
Fly.FeatureClass = Fcls;
MapCtr.Map.AddLayer (Fly);
MapCtr.ActiveView.Refresh();
}
转换成vb代码?? 求高手转换一下!!! 展开
{
IWorkspaceName pWorkspaceName = new WorkspaceNameClass() ;
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory";
pWorkspaceName.PathName = @"D:\test\Ao\data\sh\MapData.mdb";
IName n = pWorkspaceName as IName ;
IFeatureWorkspace Workspace = n.Open() as IFeatureWorkspace;
IFeatureClass Fcls = Workspace.OpenFeatureClass ("District");
IFeatureLayer Fly = new FeatureLayerClass();
Fly.FeatureClass = Fcls;
MapCtr.Map.AddLayer (Fly);
MapCtr.ActiveView.Refresh();
}
转换成vb代码?? 求高手转换一下!!! 展开
1个回答
展开全部
public sub AddAccessDBByName()
dim pWorkspaceName as IWorkspaceName
pWorkspaceName =new WorkspaceNameClass()
'--> dim pWorkspaceName as new WorkspaceNameClass
' IWorkspaceName pWorkspaceName = new WorkspaceNameClass() ;
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory" ';
pWorkspaceName.PathName = "D:\test\Ao\data\sh\MapData.mdb" ';
dim n as IName
n=pWorkspaceName
' IName n = pWorkspaceName as IName ;
'IFeatureWorkspace Workspace = n.Open() as IFeatureWorkspace;
dim Workspace as IFeatureWorkspace
Workspace=n.Open()
dim Fcls as IFeatureClass
Fcls = Workspace.OpenFeatureClass ("District")
'IFeatureClass Fcls = Workspace.OpenFeatureClass ("District");
dim Fly as new FeatureLayerClass
' IFeatureLayer Fly = new FeatureLayerClass();
Fly.FeatureClass = Fcls ';
MapCtr.Map.AddLayer (Fly) ';
MapCtr.ActiveView.Refresh() ';
end sub
应该就是这样的,你用的类我没有用过,语法上就是这样的
dim pWorkspaceName as IWorkspaceName
pWorkspaceName =new WorkspaceNameClass()
'--> dim pWorkspaceName as new WorkspaceNameClass
' IWorkspaceName pWorkspaceName = new WorkspaceNameClass() ;
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.AccessWorkspaceFactory" ';
pWorkspaceName.PathName = "D:\test\Ao\data\sh\MapData.mdb" ';
dim n as IName
n=pWorkspaceName
' IName n = pWorkspaceName as IName ;
'IFeatureWorkspace Workspace = n.Open() as IFeatureWorkspace;
dim Workspace as IFeatureWorkspace
Workspace=n.Open()
dim Fcls as IFeatureClass
Fcls = Workspace.OpenFeatureClass ("District")
'IFeatureClass Fcls = Workspace.OpenFeatureClass ("District");
dim Fly as new FeatureLayerClass
' IFeatureLayer Fly = new FeatureLayerClass();
Fly.FeatureClass = Fcls ';
MapCtr.Map.AddLayer (Fly) ';
MapCtr.ActiveView.Refresh() ';
end sub
应该就是这样的,你用的类我没有用过,语法上就是这样的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询