{I+=codeWee;}
[C++] GdiPlus: How to Get Text Extent Pixel Size
#include <GdiPlus.h>
using namespace Gdiplus;
#pragma comment(lib, "Gdiplus.lib")

void GetTextSize(const WCHAR* szText, Gdiplus::Font* font, UINT32& nTextWidth, UINT32& nTextHeight)
{
	RectF boundRect;
	Gdiplus::Bitmap bmp(4, 4);
	Gdiplus::Graphics *g = Gdiplus::Graphics::FromImage(&bmp);
	g->MeasureString(szText, (INT)wcslen(szText), font, Gdiplus::PointF(0, 0), &boundRect);

	nTextWidth = (UINT32)boundRect.Width;
	nTextHeight = (UINT32)boundRect.Height;
	delete g;
}
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.