Sign in to follow this  

Window resize

This topic is 2794 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
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

This topic is 2794 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this