Jump to content
  • Advertisement
Sign in to follow this  
Marusu

Window resize

This topic is 3010 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have this problem, when I resize the window, button which moves along with the border starts to paint itself all over the window. I tried returning DefWindowProc in WM_ERASEBKGND, also 1 and 0. Can you help me figure this out? Thanks, Martin

Share this post


Link to post
Share on other sites
Advertisement
case WM_SIZE:
{
m_pSCurrentWindow->iWidth = LOWORD(lParam);
m_pSCurrentWindow->iHeight = HIWORD(lParam);
InvalidateRect(m_pSCurrentWindow->hWindow, NULL, NULL);
return 0;
}

This was before (except return 0). Still same effect.

Share this post


Link to post
Share on other sites
Unfortunately it still doesn't work...
case WM_SIZE:
{
m_pSCurrentWindow->iWidth = LOWORD(lParam);
m_pSCurrentWindow->iHeight = HIWORD(lParam);
InvalidateRect(m_pSCurrentWindow->hWindow, NULL, NULL);
UpdateWindow(m_pSCurrentWindow->hWindow);
return 0;
}

Maybe something's wrong with WM_PAINT?
case WM_PAINT:
{
HBITMAP hButton = (HBITMAP)LoadImage(m_hInstance, m_pSCurrentWindow->SButton->wszName.c_str(), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
if (hButton == NULL)
MessageBox(m_pSCurrentWindow->hWindow, L"Button failed to initialize", L"Button", NULL);

PAINTSTRUCT psWindow;
m_pSCurrentWindow->hdcWindow = BeginPaint(m_pSCurrentWindow->hWindow, &psWindow);
HDC hdcButton = CreateCompatibleDC(m_pSCurrentWindow->hdcWindow);
SelectObject(hdcButton, hButton);
RECT R;
R.top = 10;
R.bottom = 480;
R.left = 10;
R.right = 800;
DrawText(m_pSCurrentWindow->hdcWindow, m_pSCurrentWindow->wssText.str().c_str(), m_pSCurrentWindow->wssText.str().length(), &R, DT_WORDBREAK | DT_VCENTER);

BitBlt(m_pSCurrentWindow->hdcWindow, m_pSCurrentWindow->iWidth - m_pSCurrentWindow->SButton->iWidth - 50, m_pSCurrentWindow->iHeight - m_pSCurrentWindow->SButton->iHeight - 50, m_pSCurrentWindow->SButton->iWidth, m_pSCurrentWindow->SButton->iHeight, hdcButton, 0, 0, SRCCOPY);

EndPaint(m_pSCurrentWindow->hWindow, &psWindow);
return 0;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!