C # calls Google Earth Com API Development (III)

Source: Internet
Author: User

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:}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.