BMS-HOSxP Community

HOSxP => Delphi / Pascal => ข้อความที่เริ่มโดย: James011 ที่ มกราคม 29, 2010, 10:01:42 AM

หัวข้อ: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: James011 ที่ มกราคม 29, 2010, 10:01:42 AM
 ;D ;D ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ

         Now :  Delphi Enterprise 7 + Zeos 6.6.5+MySQL 

         ถ้าจะเขียน Delphi 7 + Google map   ต้องติดตั้งอะไรเพิ่มบ้างครับ
         และเขียนไรเพิ่มบ้าง ขอคำแนะนำหน่อยครับ
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: manoi ที่ มกราคม 29, 2010, 12:19:04 PM
ผมใช้ตัวนี้ครับ

http://www.martinzone.biz/tgooglemaps/overview.html
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: James011 ที่ มกราคม 29, 2010, 12:20:18 PM
 ;D ;D ;D ขอบคุณครับ
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: James011 ที่ มกราคม 29, 2010, 13:54:22 PM
 ;D ;D  ได้ Code ใน Net มาแบบนีแต่ Run ไม่ผ่านอะครับ

procedure TForm1.Button1Click(Sender: TObject);


var _latitude:Real;
    _longitude:Real;


const _zoom = 12; // 12 = city,   8 = region


const GoogleAPIKey = 'Your Key';


var _html:TStringlist;
    _oldsep:char;
    {_web:TMsWinWeb;}


    WebBrowser1: TWebBrowser;


begin
    { _web := TMsWinWeb.Create(nil); }


    WebBrowser1:= TWebBrowser.Create(Application);
    self.InsertControl(webbrowser1);
    webbrowser1.Left := 1;
    webbrowser1.Left := 1;
    webbrowser1.Width := 640;
    webbrowser1.Height := 480;
    webbrowser1.Show;


    { _latitude := _web.WebProvider.Latitude.Trigonometric; }
    { _longitude := _web.WebProvider.Longitude.Trigonometric;}


     _oldsep := DecimalSeparator;
     DecimalSeparator := '.';


     _html := tstringlist.create;


     _html.Add('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"');
     _html.Add('  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
     _html.Add('<html xmlns="http://www.w3.org/1999/xhtml">');
     _html.Add('  <head>');
     _html.Add('   <meta http-equiv="content-type" content="text/html;
charset=utf-8"/>');
     _html.Add('    <title>Google Maps JavaScript API Example</title>');
     _html.Add('    <script
src="http://maps.google.com/maps?file=api&v=2&key=' + GoogleAPIKey +
'"');
     _html.Add('      type="text/javascript"></script>');
     _html.Add('    <script type="text/javascript">');
     _html.Add('    //<![CDATA[');
     _html.Add('    function load() {');
     _html.Add('      if (GBrowserIsCompatible()) {');
     _html.Add('        var map = new
GMap2(document.getElementById("map"));');
     _html.Add('        map.setCenter(new GLatLng(' + FloatToStr(_latitude)
+ ',' + FloatToStr(_longitude) + '),' + IntToStr(_zoom) + ');');
     _html.Add('      }');
     _html.Add('    }');
     _html.Add('    //]]>');
     _html.Add('    </script>');
     _html.Add('  </head>');
     _html.Add('  <body onload="load()" onunload="GUnload()">');
     _html.Add('    <div id="map" style="width: 640px; height:
480px"></div>');
     _html.Add('  </body>');
     _html.Add('</html>');


     _html.SaveToFile('c:\googlemap.html');


      WebBrowser1.Navigate('c:\googlemap.html');


     while webbrowser1.Busy
           do application.processmessages;


     WebBrowser1.Free;
     _html.Free;
     _web.Free;


     deletefile('c:\googlemap.html');
     DecimalSeparator := _oldsep;

end;
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: Multithreading ที่ กุมภาพันธ์ 23, 2010, 01:24:34 AM
const GoogleAPIKey = 'Your Key';   // ผิดตรงนี้ครับ 
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: Svl2Nuk3 ที่ กุมภาพันธ์ 23, 2010, 01:39:20 AM
ขอบคุณมากครับ
เดี๋ยวต้องกลับไปลองบ้าง  delphi  พึ่งจะลองเล่นได้ไม่กี่เดือนเองครับ
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: James011 ที่ กุมภาพันธ์ 23, 2010, 07:57:28 AM
const GoogleAPIKey = 'Your Key';   // ผิดตรงนี้ครับ 

ขอบคุณมากครับ
เดี๋ยวต้องกลับไปลองบ้าง  delphi  พึ่งจะลองเล่นได้ไม่กี่เดือนเองครับ



  ;D ;D ;D ;D  ทดสอบแล้วอย่าลืมรายงานผลด้วยนะครับ ว่าผ่านหรือไม่ผ่าน
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: thank ที่ กุมภาพันธ์ 25, 2010, 00:37:50 AM

  ;D ;D ;D ;D  ทดสอบแล้วอย่าลืมรายงานผลด้วยนะครับ ว่าผ่านหรือไม่ผ่าน


ลองแล้วใช้ได้
ต้องแก้ไข code นิดหน่อยครับ
_latitude    := 18.788363;
_longitude := 98.981302;
หัวข้อ: Re: ขอคำแนะนำในการเขียน Delphi 7 + Google map หน่อยครับ
เริ่มหัวข้อโดย: James011 ที่ กุมภาพันธ์ 25, 2010, 08:11:25 AM

  ;D ;D ;D ;D  ทดสอบแล้วอย่าลืมรายงานผลด้วยนะครับ ว่าผ่านหรือไม่ผ่าน


ลองแล้วใช้ได้
ต้องแก้ไข code นิดหน่อยครับ
_latitude    := 18.788363;
_longitude := 98.981302;


  ;D ;D ;D ขอบคุณมากครับ