本文介绍了Drawtext()本身不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行它时(它是一个子窗口),我得到的只是字符串的4个字母.我认为矩形足够大.我不正确使用Drawtext()吗?


when i run this, (it''s a child window), all i get is 4 letters of the string. i figure the rectangle is plenty big enough. am i using Drawtext() incorrectly?


LRESULT CALLBACK printout(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	static PAINTSTRUCT paint;
	static RECT textbox;
	static LPCTSTR blah = "this is a test";

	switch(msg)
	{
		case WM_CLOSE:
		{
                        DestroyWindow(hwnd);
			break;
		}
                case WM_DESTROY:
		{
			PostQuitMessage(0);
			break;
		}
		case WM_PAINT:
		{
			hdc = BeginPaint(hwnd, &paint);

				SetRect(&textbox, 20, 20, 300, 60);
				DrawText(hdc, blah, sizeof(blah), &textbox, DT_VCENTER);

			EndPaint(hwnd, &paint);

		}
		default:
            return DefWindowProc(hwnd, msg, wParam, lParam);
    }
    return 0;
}

推荐答案


这篇关于Drawtext()本身不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 07:41