Windows API one-day training (22) textout Function

Source: Internet
Author: User
Tags textout
Text output has always been a commonly used method. Since the text was invented, the text display should be missing. In the past, books were written on white paper to help others understand it. Now in the information age, it is certainly displayed on the screen. Even if you do not understand calligraphy, you can also display amazing calligraphy words. You can use textout to display text in the window. Function Of course, not only this API function can display Character . The textout function uses the properties of the current device to display text. For example, the property of a device has a font. Type The font color, the color of the font background, and so on.

The textout function declaration is as follows:
Wingdiapi bool winapi textouta (_ in HDC, _ in int X, _ in int y,
_ In_ecount (c) lpcstr lpstring, _ in int C );
Wingdiapi bool winapi textoutw (_ in HDC, _ in int X, _ in int y,
_ In_ecount (c) lpcwstr lpstring, _ in int C );
# Ifdef Unicode
# Define textout textoutw
# Else
# Define textout textouta

HDCIs the current device'sHandle.
XIs the X axis coordinate of the character.
YIs the Y axis coordinate of the character.
LpstringIs to display stringsPointer.
CIs the length of the display string.

An example of calling this function is as follows:
#001 void ccaiwinmsg: ondraw (HDC)
#002 {
#003 //
#004 STD: wstring strshow (_ T ("Implementation of the C ++ window class, 2007-08-13 "));
#005 textout (HDC, 10, 10, strshow. c_str (), (INT) strshow. Length ());
#006}

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.