This article continues to introduce the basics of Google Earth COM API development, as compared to the third article:
1 increase the mouse wheel support, you can zoom in, zoom out. This feature utilizes the HookAPI.dll provided in the previous article to implement
2 Read Placemarks (location in Google Earth interface) and show, hide
3 Read all layers, show and hide
Next, continue to put the code:
1, mouse wheel event, to achieve magnification, reduce
1: ...
2://Zoom
3:private Const Long zoomin = 0x00780000
4://Zoom Out
5:private const long zoomout = 0xff880000;< br> 6: ...
7:mousehook.mousewheel + = new MouseEventHandler (Mousehook_mousewheel);
8:.
9:///<summary>
10:///mouse Hook. Mouse scrolling Event
One:///</summary>
:///<param name= "sender" ></PARAM>
:///<param name= "E" & Gt;</param>
14:void Mousehook_mousewheel (object sender, MouseEventArgs e)
: {
16:intptr hWnd = Nat Ivemethods.windowfrompoint (e.location);
17:if (HWnd = = this. Gerenderhwnd)
: {
19:point point = this. Control.pointtoclient (e.location);
20://If the mouse position is inside the control, the mouse is scrolled in the range of the GoogleEarth view
21:if (this. Control.ClientRectangle.Contains (point)
: {
23:nativemethods.postmessage (gerenderhwnd, (int) wm_mous E.wm_mousewheel, E.delta = 120? Zoomin:zoomout, 0);
24:}
25:}
:}