|
-
Sep 24th, 2000, 04:16 PM
#1
Thread Starter
Fanatic Member
I know this is probably not how you should do it, nut why won't this work:
Code:
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
Text1 = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "1", WS_CHILD | ES_NUMBER, 20,20, 80, 25, hWnd,0, hInst, NULL);
HFONT hFont;
HDC hDC;
SIZE TxtSize;
CHAR* Tahoma = "Tahoma";
ShowWindow(Text1, nCmdShow);
hDC = GetDC(Text1);
GetTextExtentPoint32(hDC, "T", 1, &TxtSize);
hFont = (HFONT) CreateFont( TxtSize.cx , 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, 0, Tahoma);
SelectObject(hDC, hFont);
ReleaseDC(Text1, hDC);
if ((!hWnd) && (!Text1))
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
Unless you didn't get it, I'm trying to set the TextBox's font to Tahoma. It doesn't raise any errors, but the font is always that boldish systemy font.
Any help?
-
Sep 24th, 2000, 04:35 PM
#2
Monday Morning Lunatic
You have to send it a WM_SETFONT message:
Code:
SendMessage(Text1, WM_SETFONT, (WPARAM)Tahoma, TRUE);
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 25th, 2000, 12:58 PM
#3
Thread Starter
Fanatic Member
<ahem>
I knew that all along.
Thanks,
Moi.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|