0

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

2
Contributors
3
Replies
5
Views
12 Years
Discussion Span
Last Post by Tight_Coder_Ex
0

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.

0

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

Vince,

0
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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.