GDI programming in VB-2 brushes

Source: Internet
Author: User

Brush objects

The Brush object pen is used to draw contour lines of shapes on the device environment DC, such as rectangles, circles, and polygons, and the contour of the shape has three properties of line type, thickness, and color, which we all need to represent in a Pen object. In GDI's API functions, when manipulating brushes, we have the following commonly used functions:

1  Public Declare FunctionCreatePenLib "GDI32" Alias "CreatePen"(ByValNpenstyle as Long,ByValNwidth as Long,ByValCrcolor as Long) as Long2  Public Declare FunctionCreatepenindirectLib "GDI32" Alias "Createpenindirect"(Lplogpen asLogpen) as Long3  Public Declare FunctionExtcreatepenLib "GDI32" Alias "Extcreatepen"(ByValDwpenstyle as Long,ByValDwwidth as Long, LPLB asLogbrush,ByValDwstylecount as Long, Lpstyle as Long) as Long4  Public Declare FunctionSelectObjectLib "GDI32" Alias "SelectObject"(ByValhDC as Long,ByValHobject as Long) as Long
function function
CreatePen Creates a brush object based on the provided line type, width, and color
Createpenindirect Create a brush based on a logical font structure
Extcreatepen Create an extension brush
SelectObject Selecting brushes in the device environment

Once we have created a brush by creating a type of Create brush function, we have to select it into the device environment DC and use the function SelectObject, which is the outline of the drawing on the device environment that is displayed based on the brush. When the brush is finished, we need to call the SelectObject again, restore the brush in the device environment DC, and finally we need to remove it using DeleteObject.

GDI programming in VB-2 brushes

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.