Vc_cdc_drawtext () function usage

Source: Internet
Author: User

Purpose:
Outputs the specified substring in the specified position (rectangle.

Statement:
Int drawtext
(
HDC, // handle to DC
Lptstr lpstring, // text to draw
Int ncount, // text Length
Lprect, // formatting dimensions
Uint uformat // text-drawing options
);

Example:
DC-> drawtext ("test", crect (100,100,200,300), dt_singleline | dt_left | dt_vcenter );

DC is the object pointer of the graphical device environment description.
Other Instructions:
The final parameter format can be a combination of the following:
Bottom alignment of dt_bottom
Dt_calcrect
Horizontal center of dt_center
Dt_end_ellipsis or dt_path_ellipsis
Dt_expandtabs
Dt_externalleading
Dt_modifystring
Dt_noprefix
Dt_path_ellipsis
Align to the right of dt_right
Dt_singleline
Dt_tabstop
Top alignment of dt_top
Vertical center of dt_vcenter
Automatic line feed of dt_wordbreak

FAQs:
Q: Why does dt_vcenter not work when the drawtext function centralizes multiple lines of text in a rectangle?
A: Only single line of text can be centered. You must use the dt_singleline attribute.

Detailed description of Mark Constants
Dt_bottom must specify dt_single at the same time. Indicates text alignment to format the bottom edge of a rectangle
Dt_calcrect
Calculate and format the rectangle as follows: When drawing multiple rows, the bottom side of the rectangle is extended as needed to accommodate all text; when drawing a single row, the right side of the rectangle is extended. Do not depict text. The rectangle specified by the lprect parameter loads the calculated value.

Dt_center text vertical center
When dt_expandtabs depicts text, it expands the tabulation site. By default, the spacing between tabulation sites is 8 characters. However, you can use the dt_tabstop flag to change this setting.

When dt_externalleading is used to calculate the height of a text line, the external spacing attribute (the external
Leading attribute)
Left-aligned dt_left text
The specified rectangle is not cut when dt_noclip depicts the text.
Dt_noprefix is generally used. The function determines that the & character expression should be followed by an underscore. This flag disables such behavior
Right-aligned dt_right text
Dt_singleline draws only one row
Dt_tabstop specifies the distance between the new tabulation stations. The height of this integer is 8 bits.
Dt_top must specify dt_single at the same time. Indicates text alignment to the top of the formatted rectangle
Dt_vcenter must specify dt_single at the same time. Indicates text alignment to the center of the formatted rectangle
Dt_wordbreak for automatic line feed. If you use the settextalign function to set the ta_updatecp flag, this setting is invalid.

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.