Browse Source

winapi - fix style, delete hFont object after drawing (fixes overflow)

pull/759/merge
R4SAS 8 years ago
parent
commit
cf6d445080
  1. 8
      Win32/Win32App.cpp

8
Win32/Win32App.cpp

@ -289,6 +289,7 @@ namespace win32
hFont = CreateFont(18,0,0,0,0,0,0,0,DEFAULT_CHARSET,0,0,0,0,TEXT("Times New Roman")); hFont = CreateFont(18,0,0,0,0,0,0,0,DEFAULT_CHARSET,0,0,0,0,TEXT("Times New Roman"));
SelectObject(hDC,hFont); SelectObject(hDC,hFont);
DrawText(hDC, TEXT(s.str().c_str()), s.str().length(), &rp, DT_CENTER|DT_VCENTER); DrawText(hDC, TEXT(s.str().c_str()), s.str().length(), &rp, DT_CENTER|DT_VCENTER);
DeleteObject(hFont);
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
break; break;
} }
@ -310,12 +311,13 @@ namespace win32
wclx.cbSize = sizeof(wclx); wclx.cbSize = sizeof(wclx);
wclx.style = 0; wclx.style = 0;
wclx.lpfnWndProc = WndProc; wclx.lpfnWndProc = WndProc;
wclx.cbClsExtra = 0; //wclx.cbClsExtra = 0;
wclx.cbWndExtra = 0; //wclx.cbWndExtra = 0;
wclx.hInstance = hInst; wclx.hInstance = hInst;
wclx.hIcon = LoadIcon (hInst, MAKEINTRESOURCE(MAINICON)); wclx.hIcon = LoadIcon (hInst, MAKEINTRESOURCE(MAINICON));
wclx.hCursor = LoadCursor (NULL, IDC_ARROW); wclx.hCursor = LoadCursor (NULL, IDC_ARROW);
wclx.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); //wclx.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wclx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wclx.lpszMenuName = NULL; wclx.lpszMenuName = NULL;
wclx.lpszClassName = I2PD_WIN32_CLASSNAME; wclx.lpszClassName = I2PD_WIN32_CLASSNAME;
RegisterClassEx (&wclx); RegisterClassEx (&wclx);

Loading…
Cancel
Save