2010-03-01 4 views
0

microsoft_maps_mapcontrol을 사용하려고합니다. 나는 압정과 위도가 긴 위치를 어떻게 만들 수 있는지 봅니다 ...하지만 압핀 대신에 이미지를 사용하는 방법을 알아낼 수는 없습니다. 압정은 다른 이미지를 사용하는 것처럼 보이지 않습니다. 그래서 이미지를 생성 한 다음 올바른 위치에 어떻게 연결합니까? 유선이 가능하면 이미지를 클릭 할 때 이벤트를 사용할 수 있습니다.silverlight 빙지도 압정 질문

감사 섀넌


내가 http://www.microsoft.com/maps/isdk/silverlightbeta/#MapControlInteractiveSdk.Tutorials.UIElements.Media.TutorialPositionPointMedia

에 주어진 예에서 봤는데 내가 비주얼 베이직에 제대로 뭔가를 변환해서는 안 2010년 3월 2일

을 추가했다. 여기

코드

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 

희망에 변환이있다. 감사합니다. 섀넌

답변

1

다음은 이미지를 추가하는 방법을 보여주는 코드입니다.

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

http://msdn.microsoft.com/en-us/library/ee681895.aspx

+0

덕분에 ...의는 오프 이미지 폴더에 .. 이미지의 ... .. 궁금 해서요 ..이 VB로 변환하기 위해 최선을 다 내가 올바른 내 길을해야합니까 뿌리. image.Source = 새 BitmapImage (새 Uri ("C : \ Dev \ Sandbox \ Silverlight \ Map \ BingMaps \ BingMaps \ Images \ 1.png", UriKind.Relative)) 내가 실행할 때 아무 것도 표시되지 않습니다. . 그래서 내 경로가 올바르지 않은지 궁금하네요. – jvcoach23

+0

예. 경로가 잘못되었을 수 있습니다. 경로는 Silverlight XAP에 상대적이어야합니다. 예를 들어 XAP가 웹 사이트의 ClientBin 폴더에 있으면 이미지 폴더를 ClientBin 폴더로 이동하십시오. URI는 Uri ("/ Images/1.png", UriKind.Relative)가됩니다. 데스크톱 슬래시 구문 "\"대신 웹 슬래시 구문 "/"을 사용해야합니다. –