Hi Ppl,
Is it possible to change the font within an edit box? im not using rich edit or anything.
Cheers
TNT
Printable View
Hi Ppl,
Is it possible to change the font within an edit box? im not using rich edit or anything.
Cheers
TNT
I'm new to Windows programming, but I think that for that reason (and a couple of other text formatting reasons) you would use the rich edit. But don't quote me on this.
--Garfield the Programmer
This must be put in any WindowProc Message
DEFAULT_GUI_FONT is the default font. Change fonts by changing this to these:Code:SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,
(WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
0: Bold text
DEFAULT_GUI_FONT: Default TextCode:ANSI_FIXED_FONT: Code Font(Courier)
for example, this creates an edit window with bold font:
Code:switch(Message)
{
case WM_CREATE:
CreateWindow("EDIT", "",
WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | ES_MULTILINE |
ES_WANTRETURN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
hwnd, (HMENU)IDC_MAIN_TEXT, g_hInst, NULL);
SendDlgItemMessage(hwnd, IDC_MAIN_TEXT, WM_SETFONT,
(WPARAM)GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(TRUE, 0));
break;
So, what are the benefits of rich edit?
--Garfield
that it's a word processor, try writing HTML in one and you'll see what i mean
What do you mean?
a word processor gives extra crap to make the stuff look good when you type stuff and stuff into the crap which makes the stuff.
In otherwords....
You know, in microsoft word, you can change the font sizes, the color, and stuff? well in notepad, you can't do that. Correct? If you open a document made in microsoft word in notepad, it comes out with code tags on it. Get it?
oh and tnt, at the top of your program put this:
Code:#define IDC_MAIN_TEXT 1003