Windows Programming Note (5): client area output characters

Source: Internet
Author: User
Tags textout

The interface display program in the client area is in the processing of the WM_PAINT message placed in the callback function, and the Windows system sends an WM_PAINT message to the application window when the client area needs to be redrawn. When the window receives the message, it redraws its client area.

To display text:

1 Use the BeginPaint () function to get the device environment handle for the client area.

2 Use the TextOut () function to display the text.

3 End the display with the EndPaint () function.

The code for displaying the text is as follows:

Case Wm_paint:hdc=beginpaint (HWND,&PS); TextOut (hdc,10,10,s1,13); TextOut (hdc,20,40,s2,32); EndPaint (HWND,&PS);
Note that the beginpiant () and EndPaint () functions must be paired, just like when redrawing a window, the program has nothing to do, and it has to have this pair of functions. Otherwise, Windows will always send a WM_PAINT message to the program.

The results of this procedure are as follows:



Windows Programming Note (5): client area output characters

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.