2
我出文字,但他爬過我的窗口區域,我怎麼能修好它? 我的代碼如何通過我的窗口限制文本區域?
PAINTSTRUCT ps;
hdc=BeginPaint(hWnd3,&ps);
LOGFONT lf;
lf.lfWidth=0;
lf.lfHeight=14;
strcpy(lf.lfFaceName,"Times New Roman");
lf.lfEscapement=lf.lfStrikeOut=lf.lfUnderline=0;
lf.lfClipPrecision=CLIP_DEFAULT_PRECIS;
lf.lfCharSet=1251;
lf.lfOrientation=0;
hf=CreateFontIndirect(&lf);
SelectObject(hdc,hf);
SetTextAlign(hdc,TA_CENTER);
GetClientRect(hWnd,&r);
TextOut(hdc,r.right/2,r.bottom/2,"Some text",strlen("Some text"));
DeleteObject(hf);
EndPaint(hWnd3,&ps);
的文本這裏部分將遠遠長於「一些文本」。
我使用了這個功能,當他走到窗口區域的末端時,我需要文本到新行,就像在控制檯\ n中一樣。 Sory對這個問題進行了嚴格的形式化。我新手在WinAPI – user2650128
謝謝我發現我想用DT_WORDBREAK和所有作品完美 – user2650128