文本输出 常用的文本输出函数 Textou原型如下 B00L Textout HDC hdc int x int Y //X,Y为用户区中字符串的起始坐标 LPCTSTR Ipstring,// Ipstr ing为显示的字符串 int nCount // n Count为字符串中的字节数 Textout以坐标X,Y为起点 输出字节数为 n Count 名为 Tostring中的字符串
11 文本输出 常用的文本输出函数TextOut原型如下: BOOL TextOut ( HDC hdc, int X, int Y, //X, Y为用户区中字符串的起始坐标 LPCTSTR lpstring, //lpstring为显示的字符串 int nCount //nCount为字符串中的字节数 ); TextOut 以坐标X,Y为起点, 输出字节数为nCount、 名为lpstring中的字符串
5.3文本操作实例 例5-1】在用户窗口上输出几行字符串,当窗口接收到 WM PAINT消息后,显示的文本每次都被重新刷新。 #includewindows. h> 文本显示示例程序区 #includestdlib.h> #includestring. h> This is the first line long WINAPI WndProc( This is the second line HWND hWnd This is the third line UINT iMessage This is the fourth line This is the fifth line UINT wParam This is the sixth line LONG IParam BOOL InitWindows Class(HINSTANCE hInstance BOOL InitWindows(HINSTANCE hInstance, int nCmdShow)
12 5.3 文本操作实例 【例5-1】在用户窗口上输出几行字符串,当窗口接收到 WM_PAINT消息后,显示的文本每次都被重新刷新。 #include<windows.h> #include<stdlib.h> #include<string.h> long WINAPI WndProc( HWND hWnd, UINT iMessage, UINT wParam, LONG lParam ); BOOL InitWindowsClass(HINSTANCE hInstance); BOOL InitWindows(HINSTANCE hInstance,int nCmdShow);