.Net/Winform

C# Winform에서 DaumAPI 사용하기[2]_JavaScript 메서드 호출

동구밖과수원 2012. 9. 14. 17:03

 

WebBrowser 컨트롤의 Document 개체를 이용해서

JavaScript의 GetPoint function을 호출하고 문자열을 리턴받기

 

 

C#

string value = (string)this.Document.InvokeScript("GetPoint", new object[] { latLng.Lat, latLng.Lng }).ToString();


 

 

JavaScript

    //해당 위도경도에 해당하는 Point를 가져온다.
    function GetPoint(lat, lng) {
        var point = m_projection.pointFromCoords(new daum.maps.LatLng(lat, lng));
        return point.toString();
    }