15.windows Drawing (ii)

Source: Internet
Author: User

1.GDI Drawing objects-brushes

(1) function

Line color, linetype, line thickness

(2) Use

A. Creating a handle

Hpen CreatePen (int fnpenstyle,//Brush style

int nwidth,//thickness of brush

COLORREF crcolor); The color of the brush

Successful, returns the brush handle

Brush style: ps_solid-solid line, can support multiple pixel width, other linetype can only be one pixel wide

Ps_dash-Dashed line

Ps_dot-Dot Line

Ps_dashdot-a dashed line and a point alternately appear

Ps_dashdotdot-dashed and two dots alternately appear

B. Applying a brush to a DC

Hgdiobj SelectObject (HDC hdc,//drawing device handle

Hgdiobj hgdiobj); GDI drawing object handle, brush handle

Successful, returns the original GDI drawing object handle (note the brush that saved the original DC).

C. Drawing

D. Remove the brushes from the DC

Putting the original brush in the device DC with the SelectObject function will remove the brush we created.

E. Releasing brushes

BOOL DeleteObject (Hgdiobj hobject);

You can only delete brushes that are not used by the DC, so you must remove the brush from the DC before releasing it

     

15.windows Drawing (ii)

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.