vb.net有map吗 vbnet map

请问vb.net添加了ARCGIS的mapcontrol控件后如何添加shp文件然后显示出来?

你好 ,试下下面代码,希望对你有用

成都创新互联从2013年成立,是专业互联网技术服务公司,拥有项目成都做网站、成都网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元绵竹做网站,已为上家服务,为绵竹各地企业和个人服务,联系电话:18980820575

//这是直接根据路径名称加载

private voidmenuAddShp_Click(object sender, EventArgs e)

{

IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();

IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(@"D:\GIS-Data",0);

IFeatureWorkspace pFeatureWorkspace =pWorkspace as IFeatureWorkspace;

IFeatureClass pFC =pFeatureWorkspace.OpenFeatureClass("continent.shp");

IFeatureLayer pFLayer = new FeatureLayerClass();

pFLayer.FeatureClass = pFC;

pFLayer.Name = pFC.AliasName;

ILayerpLayer = pFLayer as ILayer;

IMappMap = axMapControl1.Map;

pMap.AddLayer(pLayer);

axMapControl1.ActiveView.Refresh();

}

//这段是利用对话框添加

从工具箱往窗体上添加一个OpenFileDialog控件。

private voidmenuAddShp_Click(object sender, EventArgs e)

{

IWorkspaceFactorypWorkspaceFactory = new ShapefileWorkspaceFactory();

openFileDialog1.Filter = "shapefile文件(*.shp)|*.shp";

openFileDialog1.InitialDirectory = @"D:\GIS-Data";

openFileDialog1.Multiselect = false;

DialogResultpDialogResult = openFileDialog1.ShowDialog();

if(pDialogResult != DialogResult.OK)

return;

stringpPath = openFileDialog1.FileName;

stringpFolder = Path.GetDirectoryName(pPath);

stringpFileName = Path.GetFileName(pPath);

IWorkspacepWorkspace = pWorkspaceFactory.OpenFromFile(pFolder,0);

IFeatureWorkspacepFeatureWorkspace = pWorkspace as IFeatureWorkspace;

IFeatureClasspFC = pFeatureWorkspace.OpenFeatureClass(pFileName);

IFeatureLayerpFLayer = new FeatureLayerClass();

pFLayer.FeatureClass = pFC;

pFLayer.Name = pFC.AliasName;

ILayerpLayer = pFLayer as ILayer;

IMap pMap =axMapControl1.Map;

pMap.AddLayer(pLayer);

axMapControl1.ActiveView.Refresh();

}

vb.net桌面中bitmap类如何直接绘制到屏幕?

可以直接显示的。你看下面的示例,使用vb.net画的齿轮:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

b = New Bitmap(PictureBox1.Width, PictureBox1.Height)

g = Graphics.FromImage(b)

'g.RotateTransform(90)

g.Clear(Color.White)

g.TranslateTransform(PictureBox1.Width / 2, PictureBox1.Height / 2)

g.ScaleTransform(1, -1)

'g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias

g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality

DrawCL(g, New PointF(Val(TextBox1.Text), Val(TextBox2.Text)), Val(TextBox3.Text), Val(TextBox4.Text), Val(TextBox5.Text), Val(TextBox6.Text), Val(TextBox7.Text), Val(TextBox8.Text), Val(TextBox9.Text))

DrawCL(g, New PointF(Val(TextBox18.Text), Val(TextBox17.Text)), Val(TextBox16.Text), Val(TextBox15.Text), Val(TextBox14.Text), Val(TextBox13.Text), Val(TextBox12.Text), Val(TextBox11.Text), Val(TextBox10.Text))

PictureBox1.Image = b

End Sub

vb.net 如何嵌入地图

新建一个文件,写入下面的代码:

!doctype html

html

head

meta name="viewport" content="initial-scale=1.0, user-scalable=no" /

meta http-equiv="Content-Type" content="text/html; charset=gbk" /

titleBaidu Map V1.2/title

script type="text/javascript" src=";services=true"

!-- add baidu map api --

/script

/head

body

div id="container" style="width: 600px; height: 400px;"

/div

/body

/html

script type="text/javascript"

var map = new BMap.Map("container");                 // new Map

var point = new BMap.Point(116.397128, 39.916527);      // Location, (经度, 纬度)

map.centerAndZoom(point, 15);                        // show Map

// 添加缩放功能

map.enableScrollWheelZoom();

map.enableKeyboard();

/script

保存到程序exe同一目录下,文件名:map.html

然后BUTTON点击事件:

WebBrowser1.Navigate(Application.StartupPath  "\map.html")

这样就可以了

ps:经纬度可以到百度地图官网去获取

或者到:  去生成代码


网站标题:vb.net有map吗 vbnet map
标题URL:http://pwwzsj.com/article/hhisic.html