How would one change the size of the font and/or the font itself. Im using win32 (I guess.. its not MFC).... Does anyone know how to do this in c++.... Thanks...
Vince

Recommended Answers

All 3 Replies

CreateFont as 14 parameters that need be passed to it, and it will provide you with everything you need to create the font you need.

Wow... Ok... Could You Give Me An Example... I have No Idea Where To Begin... Thanks

Vince,

case WM_CREATE:
GetClientRect (hWnd, &Rc);
InflateRect (&Rc, -10, -10);
 
StatusArea = DisplayArea = Rc;
StatusArea.top = StatusArea.bottom - 32;
DisplayArea.top += 32;
DisplayArea.bottom = StatusArea.top - 10;
 
EditWnd = CreateWindowEx (WS_EX_STATICEDGE | WS_EX_CLIENTEDGE, "EDITCTL", NULL,
				WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL,
				Rc.left, Rc.top, Rc.right - 
				Rc.left, 22,
				hWnd, (HMENU) IDC_EDIT, hInst, NULL);
 
SendMessage (EditWnd, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG (8, 8));
SendMessage (EditWnd, WM_SETFONT,
		 int (GetStockObject (DEFAULT_GUI_FONT)),
		 MAKELPARAM (false, 0));
DisplayFont = [b]CreateFont (-12, 0, 0, 0, FW_DONTCARE, false, false, false, OEM_CHARSET,[/b]
[b]				OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,[/b]
[b]				DEFAULT_PITCH | FF_DONTCARE, "Arial");[/b]
SetFocus (EditWnd);
break;

and then to use

HDC Dc = GetDC (MainWnd);
[b]SelectObject (Dc, DisplayFont);[/b]
SetBkMode (Dc, TRANSPARENT);

There is a utility provided with VC++ 6.0 called FontView. It allows you to visually see what all the setting will do and then you need just duplicate them in CreateFont

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.