@@ -40,26 +40,7 @@ namespace maxGUI
4040 }
4141#pragma warning(pop)
4242 Win32String win32_text = Utf8ToWin32String (std::move (text));
43- // return CreateWindowEx(0, TEXT("BUTTON"), win32_text.text_, win32_styles, rectangle.TopLeft.X(), rectangle.TopLeft.Y(), rectangle.Width, rectangle.Height, parent_window_handle, NULL, reinterpret_cast<HINSTANCE>(GetWindowLongPtr(parent_window_handle, GWLP_HINSTANCE)), NULL);
44- HWND window_handle = CreateWindowEx (0 , TEXT (" BUTTON" ), win32_text.text_ , win32_styles, rectangle.TopLeft .X (), rectangle.TopLeft .Y (), rectangle.Width , rectangle.Height , parent_window_handle, NULL , reinterpret_cast <HINSTANCE>(GetWindowLongPtr (parent_window_handle, GWLP_HINSTANCE)), NULL );
45-
46- static int count = 0 ;
47- if (count == 0 ) {
48- LOGFONT lf = {0 };
49- SystemParametersInfo (SPI_GETICONTITLELOGFONT, sizeof (lf), &lf, 0 );
50- HFONT font = CreateFontIndirect (&lf);
51- SendMessage (window_handle, WM_SETFONT, reinterpret_cast <WPARAM>(font), TRUE );
52- } else {
53- // const int font_height_in_points = 14;
54- // HDC screen_device_context = GetDC(NULL);
55- // const int font_height_in_logical_units = -MulDiv(font_height_in_points, GetDeviceCaps(screen_device_context, LOGPIXELSY), 72);
56- const int font_height_in_logical_units = -14 ;
57- HFONT font = CreateFont (font_height_in_logical_units, 0 , 0 , 0 , FW_DONTCARE, FALSE , FALSE , FALSE , ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE | DEFAULT_PITCH, TEXT (" Segoe UI Variable" ));
58- SendMessage (window_handle, WM_SETFONT, reinterpret_cast <WPARAM>(font), TRUE );
59- }
60- count++;
61-
62- return window_handle;
43+ return CreateWindowEx (0 , TEXT (" BUTTON" ), win32_text.text_ , win32_styles, rectangle.TopLeft .X (), rectangle.TopLeft .Y (), rectangle.Width , rectangle.Height , parent_window_handle, NULL , reinterpret_cast <HINSTANCE>(GetWindowLongPtr (parent_window_handle, GWLP_HINSTANCE)), NULL );
6344 }
6445#endif
6546
0 commit comments