我如何将bing地图纳入vb.net程序? [英] how do i incorporate bing maps into vb.net program ?

查看:99
本文介绍了我如何将bing地图纳入vb.net程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



hi 



< g class =" gr_ gr_15 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 15" ID = QUOT; 15" I标记< / g取代;使用vb.net-2008写了一个桌面应用程序。
$


< g class =" gr_ gr_23 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 23" ID = QUOT; 23" I标记< / g取代;希望我的应用的用户能够输入地址,然后在地图上查看该位置
。< g class =" gr_ gr_24 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 24英寸; ID = QUOT; 24英寸; I标记< / g取代;将地址转换为lat-long坐标。



程序用于使用不再有效的谷歌地图。

错误信息。你似乎在使用不受支持的浏览器。

几个论坛都说过这个问题永远无法解决。



?你能告诉我在哪里< g class =" gr_ gr_25 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace"数据-GR-ID =" 25" ID = QUOT; 25" I标记< / g取代;可以找到关于如何将(bing)地图
合并到我的vb.net程序中的说明..示例代码等。



jerry .. wa0h .. jerrywa0h@sbcglobal.net


hi 

<g class="gr_ gr_15 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="15" id="15">i</g> wrote a desktop app using vb.net-2008.

<g class="gr_ gr_23 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="23" id="23">i</g> want the user of my app to be able to enter an address and then see that location on a map .. <g class="gr_ gr_24 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="24" id="24">i</g> will convert the address to a lat-long coordinate.

the program used to use google maps which no longer works.
error message .. You seem to be using an unsupported browser.
several forums have said this problem will never be fixed.

? can you tell me where <g class="gr_ gr_25 gr-alert gr_tiny gr_spell gr_inline_cards gr_run_anim ContextualSpelling multiReplace" data-gr-id="25" id="25">i</g> can find instructions on how to incorporate (bing) maps into my vb.net program .. sample code, etc.

jerry .. wa0h .. jerrywa0h@sbcglobal.net

推荐答案

您需要一个api密钥:

You will need an api key:

https://www.microsoft.com/en-us/ maps / create-a-bing-maps-key

然后,这是一个如何使用它来获取地图的示例:

Then here is an example of how to use it to get a map:

'bing maps api example
Public Class Form1
Private Sub Form1_Load(sender as Object,e As EventArgs)Handles MyBase.Load
DoubleBuffered = True
BackgroundImageLayout = ImageLayout.None

Dim BingMapsKey As String ="在这里输入你的api密钥"

'点标签
'Dim url As String =" http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels/35.1377868652344,-106.642822265625/8 ?mapSize = 1000,1000&安培;键= BingMapsKey"
'rect
Dim url As String =" http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels?mapArea = 35,-108,37,-106& mapSize = 600600&安培;键= QUOT; &安培; BingMapsKey

Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(url)

使用请求As System.Net.WebResponse = req.GetResponse
使用stream As System.IO.Stream = request.GetResponseStream
Dim bmp As Bitmap
bmp = New Bitmap(System.Drawing.Image.FromStream(stream))
BackgroundImage = CType( bmp.Clone,Bitmap)
bmp.Dispose()
结束使用
结束使用
结束子
结束类

'bing maps api example Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load DoubleBuffered = True BackgroundImageLayout = ImageLayout.None Dim BingMapsKey As String = "enter your api key here" 'point with labels 'Dim url As String = "http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels/35.1377868652344,-106.642822265625/8?mapSize=1000,1000&key=BingMapsKey" 'rect Dim url As String = "http://dev.virtualearth.net/REST/v1/Imagery/Map/AerialWithLabels?mapArea=35,-108,37,-106&mapSize=600,600&key=" & BingMapsKey Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(url) Using request As System.Net.WebResponse = req.GetResponse Using stream As System.IO.Stream = request.GetResponseStream Dim bmp As Bitmap bmp = New Bitmap(System.Drawing.Image.FromStream(stream)) BackgroundImage = CType(bmp.Clone, Bitmap) bmp.Dispose() End Using End Using End Sub End Class


这篇关于我如何将bing地图纳入vb.net程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆