silverlight bing地图图钉问题
我正在尝试使用microsoft_maps_mapcontrol。我知道如何创建图钉和横向位置。。。但我不知道如何用图像代替图钉。看起来图钉不允许使用不同的图像。因此,在这种情况下,如何创建图像,然后将其连接到适当的点。一旦连线,我将能够在点击图像时使用事件 谢谢 香农silverlight bing地图图钉问题,silverlight,pushpin,Silverlight,Pushpin,我正在尝试使用microsoft_maps_mapcontrol。我知道如何创建图钉和横向位置。。。但我不知道如何用图像代替图钉。看起来图钉不允许使用不同的图像。因此,在这种情况下,如何创建图像,然后将其连接到适当的点。一旦连线,我将能够在点击图像时使用事件 谢谢 香农 2010年3月2日增补 我已经看了上面给出的例子 我一定没有正确地将某些东西转换为vb 这是密码 Image image = new Image(); image.Source = new BitmapImage(new
2010年3月2日增补 我已经看了上面给出的例子 我一定没有正确地将某些东西转换为vb 这是密码
Image image = new Image();
image.Source = new BitmapImage(new Uri(ImageUriValue.Text, UriKind.RelativeOrAbsolute));
double opacity;
if (double.TryParse(OpacityText.Text, out opacity))
{
image.Opacity = opacity;
}
image.ImageFailed += MediaFailed;
Point point = GetPoint();
Canvas.SetLeft(image, point.X);
Canvas.SetTop(image, point.Y);
myCanvas.Children.Add(image);
element = image;
我把它转换成什么
Dim image As New Image()
image.Source = New BitmapImage(New Uri("\Images\1.png", UriKind.RelativeOrAbsolute))
Canvas.SetLeft(image, 100)
Canvas.SetTop(image, 100)
myCanvas.Children.Add(image)
element = image
希望这有助于发现我做得不对的地方。
谢谢
shannon这里有一个代码片段,可以向您展示如何添加图像
public void addImageToMap()
{
MapLayer imageLayer = new MapLayer();
Image image = new Image();
//Define the URI location of the image
image.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("myimage.png", UriKind.Relative));
//Define the image display properties
image.Opacity = 0.8;
image.Stretch = System.Windows.Media.Stretch.None;
//The map location to place the image at
Location location = new Location() { Latitude = -45, Longitude = 122 };
//Center the image around the location specified
PositionOrigin position = PositionOrigin.Center;
//Add the image to the defined map layer
imageLayer.AddChild(image, location, position);
//Add the image layer to the map
TestMap.Children.Add(imageLayer);
}
谢谢。。当然,我已经尽力将其转换为vb。。我在想。。我的路径正确吗。。。对于图像。。它位于根目录下的图像文件夹中。image.Source=New BitmapImage(新Uri(“C:\Dev\Sandbox\silverlight\Map\BingMaps\BingMaps\Images\1.png”,UriKind.Relative)),运行它时不会显示任何内容。。所以我想知道我的路径是否不正确是的,路径是不正确的。路径需要相对于Silverlight XAP。例如,如果您的XAP位于网站的ClientBin文件夹中,请将图像文件夹移动到ClientBin文件夹中。然后您的URI将是URI(“/Images/1.png”,UriKind.Relative)。请注意,您需要使用web斜杠语法“/”而不是桌面斜杠语法“\”。