Googib's Blog GoogleMap & Excel Step by Step

GoogleMap,Google,Map,GoogleMapAPI,Mapapi,excel 2003

Posts Tagged ‘position?:GControlPosition

Class GMap2 –> Methods Controls

leave a comment »

Methods ในส่วนนี้จะเอาไว้ใช้สำหรับ กำหนด Controls ให้กับแผนที่เรานำมาแสดง มีรูปแบบการใช้งานดังนี้

addControl(control:GControl, position?:GControlPosition)

  1. addControl(control:GControl, position?:GControlPosition) Method นี้ใช้ในการเพิ่มตัว control ต่างๆลงบนแผนที่ดังรูปโดยการใช้งาน Method นี้ต้องใช้ร่วมกับ Constructor ของ Class Gcontrol ด้วย Constructor ของ Class Gcontrol มีให้เราดลือกใช้เยอะแยะครับแล้วแต่ว่าเราต้องการใช้อันไหนบ้าง ส่วนอีกตัวคือ GControlPosition ส่วนนี้จะเป็ฯการกำหนดตำแหน่งของการแสดง Control ในแผนที่ครับ ตัวอย่างข้างบนนะครับ มีวิธีการใช้งานคือ
    ——————————————————–
    map.addControl(new GLargeMapControl());
    ——————————————————–
    จากตัวอย่างการเพิ่ม Control เข้าไปในแผนที่ เราจะไม่ค่อยนิยมกำหนดตำแหน่ง Control ในแผนที่นะครับ เพราะ Google ได้กำหนด ค่าเริ่มต้นในตำแหน่งต่างๆไว้ดีแล้วครับ
  2. removeControl(control:GControl) ลักษณะการใช้งานก็เหมือนกับตัว addControl ทำหน้าที่ในการเอา Control ที่แสดงในแผนที่ออก——————————————————–
    map.removeControl(new GLargeMapControl());
    ——————————————————–

ตัวอย่างการใช้งาน Class GMap2 –> Methods Controls

————————————————————————————

Written by GooGib

เมษายน 29, 2009 at 3:51 am

Follow

Get every new post delivered to your Inbox.