Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change text size in basic text window win32 c++

I am making a very basic tic tac toe game as my first ever attempt at anything windows. I have only a small amount of basic c++ experience as well. At the top of my program i want it to display in a large font "WELCOME TO TIC-TAC-TOE!", and then right underneath it in a much smaller font something like "DEVELOPED BY ....." or something. This is the code i wrote making the text window:

    CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("STATIC"),TEXT("WELCOME TO TIC-TAC-TOE!"), WS_CHILD|WS_VISIBLE|SS_CENTER, 20,20,210,20,hWnd,HMENU(NULL),GetModuleHandle(NULL),NULL);

Is there a way to make the text font for "WELCOME TO TIC-TAC-TOE!" bigger? Thanks!

like image 527
Riley Avatar asked Dec 02 '22 22:12

Riley


1 Answers

The following code worked if any are interested, thanks to ScottMcP-MVP for pointing me to the right website:

        hwnda = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("STATIC"),TEXT("WELCOME TO TIC-TAC-TOE!"), WS_CHILD|WS_VISIBLE|SS_CENTER, 20,20,210,20,hWnd,HMENU(NULL),GetModuleHandle(NULL),NULL);
        hFont=CreateFont (20, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Arial");
    SendMessage (hwnda, WM_SETFONT, WPARAM (hFont), TRUE);
like image 55
Riley Avatar answered Dec 21 '22 10:12

Riley