VC paint brush and paint brush

Source: Internet
Author: User
Tags transparent image

6. Use a paint brush to change the line color and type:

Cpen pen (ps_dot, 1, RGB (0,255, 0); // constructs a paint brush object
Cclientdc DC (this); cpen * poldpen = Dc. SelectObject (& pen); // select the brush into the DC
DC. moveTo (m_ptorigin );
DC. lineto (point );
DC. SelectObject (poldpen); // restore the previous paint brush

7. Use a paint brush (usually fill the rectangular area with a paint brush ):

Use a monochrome paint brush

Cbrush brush (RGB (255, 0, 0); // construct a paint brush object
Cclientdc DC (this );
DC. fillrect (crect (m_ptorigin, point), & brush); // fill the rectangular area with the specified paint brush

Use bitmap painter

Cbitmap bitmap; // construct a bitmap object (trial is required before use)
Bitmap. loadbitmap (idb_bitmap1); // The first bitmap object.
Cbrush brush (& Bitmap); // constructs a bitmap brush.
Cclientdc DC (this );
DC. fillrect (crect (m_ptorigin, point), & brush); // fill the rectangular area with the specified bit image

Use a transparent image brush

Cbrush * pbrush = cbrush: fromhandle (hbrush) getstockobject (null_brush); // obtain the pointer of a transparent image brush object
Cclientdc DC (this );
Cbrush * poldbrush = Dc. SelectObject (pbrush); // select DC for transparent image painting.
DC. rectangle (crect (m_ptorigin, point ));
DC. SelectObject (poldbrush); // release the transparent paint brush
Note:
The getstockobject function retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes.
Hgdiobj getstockobject (
Int fnobject // type of stock object
);

Returns a pointer to a cbrush object when given a handle to a Windows hbrush object.
Static cbrush * Pascal fromhandle (hbrush); // fromhandle is a static method, so it can be called in the form of cbrush: fromhandle.

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.