GDI + Study Notes (1)

Source: Internet
Author: User

The GDI + function is extended in terms of painting brush. It supports linear and gradient painting brush, and can fill in graphics, paths, and areas. the gradient Paint Brush can also be used to draw straight lines, curves, and paths. therefore, you can use a path to set the gradient color. in VC ++. use GDI + in net2005. h contains <gdiplus. h> header file, and then add gdiplus to the property> connector> additional reference library. lib file. then in the Application Program Oninitapplication () in, initialize the gdiplus device, Code As follows:
Using namespace gdiplus;
Gdiplusstartupinput ginput;
Gdiplusstartup (& m_gdiplustoken, & ginput, null );
After the application exits, add the following functions to the exitinstance:
Using namespace gdiplus;
Gdipusshutdown (m_gdiplustoken );
Next, you can use GDI +. Add the following code to ondraw:
Using namespace gdiplus;
Graphics g (PDC-> m_hdc );
Point Points [] = point points [] = {point (), point ),
Point (150,150), point (75,100), point (0,150), point (50, 50 )};
Graphicspath path;
Path. addlines (points, 10 );
Pathgradientbrush pgbrush (& Path );

Pgbrush. setcentercolor (color (255,255, 0 ));

Color Colors [] = {color (, 0,), color ),
Color (255,255,255,255,), color ),
Color (,), color ),
Color (0,255, 255,255,255,255), color ),
Color (,), color )};
Int COUNT = 10;
Pgbrush. setsurroundcolors (colors, & COUNT );
G. fillpath (& pgbrush, & Path );

Related Article

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.