Jump to content

xifati

Inactive Member
  • Posts

    2
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by xifati

  1. 15 hours ago, martysama0134 said:

    I used GetWindowRect to calculate the dropshadow area automatically:

    		AdjustSize(m_pySystem.GetWidth(), m_pySystem.GetHeight());
    
    		if (Windowed)
    		{
    			m_isWindowed = true;
    			RECT rc{};
    			GetClientRect(&rc);
    			auto windowWidth = rc.right - rc.left;
    			auto windowHeight = (rc.bottom - rc.top);
    			//TraceError("windowWidth %d == %d windowHeight %d == %d", windowWidth, m_pySystem.GetWidth(), windowHeight, m_pySystem.GetHeight());
    			RECT rc2{};
    			GetWindowRect(&rc2);
    			auto windowWidth2 = rc2.right - rc2.left;
    			auto windowHeight2 = (rc2.bottom - rc2.top);
    			//TraceError("windowWidth2 %d windowHeight2 %d", windowWidth2, windowHeight2);
    			auto windowWidthDiff = windowWidth2 - windowWidth;
    			auto windowHeightDiff = windowHeight2 - windowHeight;
    			//TraceError("windowWidthDiff %d windowHeightDiff %d", windowWidthDiff, windowHeightDiff);
    			//TraceError("GetLastError %d", ::GetLastError());
    			constexpr auto taskbarSize = 80;
    			auto dropshadowSize = (windowWidthDiff / 2 != 0) ? (windowWidthDiff / 2 - 1) : 0;
    			CMSApplication::SetPosition(((GetScreenWidth() - windowWidth) / 2) - dropshadowSize, (GetScreenHeight() - windowHeight - taskbarSize) / 2);
    		}
    		else
    		{
    			m_isWindowed = false;
    			SetPosition(0, 0);
    		}

    This one is for 1920x1080 res

    https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowrect

    Old way with second window:

    		AdjustSize(m_pySystem.GetWidth(), m_pySystem.GetHeight());
    
    		if (Windowed)
    		{
    			m_isWindowed = true;
    			RECT rc{};
    			GetClientRect(&rc);
    			auto windowWidth = rc.right - rc.left;
    			auto windowHeight = (rc.bottom - rc.top);
    			//TraceError("windowWidth %d == %d windowHeight %d == %d", windowWidth, m_pySystem.GetWidth(), windowHeight, m_pySystem.GetHeight());
    			RECT rc2{};
    			GetWindowRect(&rc2);
    			auto windowWidth2 = rc2.right - rc2.left;
    			auto windowHeight2 = (rc2.bottom - rc2.top);
    			//TraceError("windowWidth2 %d windowHeight2 %d", windowWidth2, windowHeight2);
    			auto windowWidthDiff = windowWidth2 - windowWidth;
    			auto windowHeightDiff = windowHeight2 - windowHeight;
    			//TraceError("windowWidthDiff %d windowHeightDiff %d", windowWidthDiff, windowHeightDiff);
    			//TraceError("GetLastError %d", ::GetLastError());
    			auto dropshadowSize = (windowWidthDiff / 2 != 0) ? (windowWidthDiff / 2 - 1) : 0;
    #ifdef ENABLE_CENTERED_CLIENT_WINDOW
    			constexpr auto taskbarSize = 80;
    			CMSApplication::SetPosition(((GetScreenWidth() - windowWidth) / 2) - dropshadowSize, (GetScreenHeight() - windowHeight - taskbarSize) / 2);
    #else
    			constexpr auto taskbarSize = 73;
    			constexpr auto titlebarSize = 10;
    			if (bAnotherWindow)
    				CMSApplication::SetPosition(GetScreenWidth() - windowWidth - dropshadowSize, GetScreenHeight() - windowHeight - taskbarSize);
    			else
    				SetPosition(-dropshadowSize, -titlebarSize);
    #endif
    		}
    		else
    		{
    			m_isWindowed = false;
    			SetPosition(0, 0);
    		}

     

    kr9BAPO.png

    It not works well with the vs19/22 titlebar, as you see the titlebar's top is slammed down. (It's white here, open the image in new tab)
    Is it possible to fix somehow? or change the titlebar height smaller like it was in vs2013?

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.