/************************************************* 関数名 DrawStringToHDC 機能 メモリデバイスコンテキストに文字列を出力 iXsize : 出力画像の幅(Width) iYpos : 縦方向の出力位置 *************************************************/ void DrawStringToHDC(HDC hdc, CStringW csw, int iXsize,int iYpos) { wchar_t wct[512]; SIZE sz; ZeroMemory(&wct, 512); wcscpy_s(wct, csw); //中央に描画する GetTextExtentPoint32W(hdc, wct, lstrlenW(wct), &sz); TextOutW(hdc, (iXsize - sz.cx) / 2, iYpos, wct, lstrlenW(wct)); }
ネタ元