Application of GDI + in Win32 (iii)---graphics class

Source: Internet
Author: User

As I understand it, graphics is an intermediary between device context and your drawing conetent. It stores the relevant properties of the device context, as well as the properties of the drawing content. In this way, it can "map" drawing content to device content in its own way.
The drawing work in GDI is done directly on device context. In gdi-+, you need to create a graphics on the device context, and then call the graphics related methods to complete the drawing work.
The graphics class has four constructors:

    Static graphics* FROMHDC (in hdc hdc)    {        return new Graphics (HDC);    }    Static graphics* FROMHDC (in HDC hdc, in                             HANDLE hdevice)    {        return new Graphics (HDC, hdevice);    }    Static graphics* Fromhwnd (in HWND hwnd, in                              BOOL ICM = FALSE)    {        return new Graphics (HWND, ICM);    }    static graphics* fromimage (in Image *image)    {        return new Graphics (image);    }

Constructor 1 creates a graphics class from the Image object. This method allows you to manipulate a bitmap by using the Grapgics method after opening a sheet or creating a bitmap.

Constructor 2 Gets a graphics object from a traditional hdc and takes over the traditional operations done in HDC.

Constructor 3 allows you to create an instance of a graphics class that is bound to a particular device.

Constructor 4 allows you to directly get a graphics class instance directly from a specific window hwnd.

Reprint Address: http://www.cppblog.com/dingding/archive/2008/06/27/54795.html

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.