vb.net有map嗎 vbnet map

請(qǐng)問vb.net添加了ARCGIS的mapcontrol控件后如何添加shp文件然后顯示出來?

你好 ,試下下面代碼,希望對(duì)你有用

成都創(chuàng)新互聯(lián)從2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都做網(wǎng)站、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元綿竹做網(wǎng)站,已為上家服務(wù),為綿竹各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575

//這是直接根據(jù)路徑名稱加載

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();

}

//這段是利用對(duì)話框添加

從工具箱往窗體上添加一個(gè)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 如何嵌入地圖

新建一個(gè)文件,寫入下面的代碼:

!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,?(經(jīng)度,?緯度)

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

//?添加縮放功能

map.enableScrollWheelZoom();

map.enableKeyboard();

/script

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

然后BUTTON點(diǎn)擊事件:

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

這樣就可以了

ps:經(jīng)緯度可以到百度地圖官網(wǎng)去獲取

或者到: ?去生成代碼

當(dāng)前題目:vb.net有map嗎 vbnet map
分享地址:http://www.muchs.cn/article2/hhisic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷推廣、網(wǎng)站設(shè)計(jì)、定制網(wǎng)站、網(wǎng)站策劃、Google、建站公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化