For a long time did not update the "C # call Google Earth Com API development" series of articles, today brought to you is the third, this article compared to the second main improvement of three aspects.
1) to achieve GoogleEarth display screen changes with the size of the window
2 intercept GoogleEarth Mouse message, realize click, double-click function; mouse wheel zoom now only zoom in! O (∩_∩) o~
3 Implement GoogleEarth Color screenshot (test environment: Windows 2003 Server, Vista and Win7 are not available, XP not measured)
Let's continue to look at the code:
1, GoogleEarth dynamic change size
1:///<summary>
2:///Change the size of the GoogleEarth view
3:///</summary>
4:private void Resizegooglecontrol ()
5: {
6:nativemethods.sendmessage (Gehwnd, (UINT) Nativemethods.wm_command, nativemethods.wm_paint, 0);
7:nativemethods.postmessage (Gehwnd, nativemethods.wm_qt_paint, 0, 0);
8:
9:rect mainrect = new RECT ();
10:nativemethods.getwindowrect (Gehwnd, out mainrect);
11:clientrect = new RECT ();
12:nativemethods.getclientrect (Gehrender, out clientrect);
13:
14:int OFFSETW = mainrect.width-clientrect.width;
15:int offseth = mainrect.height-clientrect.height;
16:
17:int Newwidth = this. Control.width + (int) offsetw;
18:int Newheight = this. Control.height + (int) Offseth;
19:
20:nativemethods.setwindowpos (Gehwnd, Nativemethods.hwnd_top,
21:0, 0, Newwidth, Newheight,
22:nativemethods.swp_framechanged);
23:
24:nativemethods.sendmessage (Gehwnd, (UINT) Nativemethods.wm_command, nativemethods.wm_size, 0);
25:}