954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Change Font Size... c++

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

Vincentjames501
Newbie Poster
6 posts since Mar 2005
Reputation Points: 10
Solved Threads: 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.

Tight_Coder_Ex
Posting Whiz in Training
215 posts since Feb 2005
Reputation Points: 47
Solved Threads: 17
 

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

Vince,

Vincentjames501
Newbie Poster
6 posts since Mar 2005
Reputation Points: 10
Solved Threads: 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 = <strong>CreateFont (-12, 0, 0, 0, FW_DONTCARE, false, false, false, OEM_CHARSET,</strong>
<strong>				OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,</strong>
<strong>				DEFAULT_PITCH | FF_DONTCARE, "Arial");</strong>
SetFocus (EditWnd);
break;


and then to use

HDC Dc = GetDC (MainWnd);
<strong>SelectObject (Dc, DisplayFont);</strong>
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

Tight_Coder_Ex
Posting Whiz in Training
215 posts since Feb 2005
Reputation Points: 47
Solved Threads: 17
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You