The first slice the original image is
With LoadImage and BitBlt drawn to form is the same as shown in figure 2
down in qualityAsk bosses that function will make the image down, and if there is any solution
CodePudding user response:
To add a questionAfter the image is drawn, not flushed to form
Want to drag the window manually refresh to display,
Windowupdate redrawwindow movewindow setwindowpos tried all invalid
For bosses to save
CodePudding user response:
LRESULT a CALLBACK WndProc (HWND HWND, UINT message, WPARAM WPARAM, LPARAM LPARAM)
{
The switch (the message)
{
In case the WM_PAINT:
{
PAINTSTRUCT ps;
HDC HDC=BeginPaint (hWnd, & amp; Ps);
//load the bitmap
HBITMAP hBmp=(HBITMAP) LoadImage (NULL, _T (" C: \ \ TEMP \ \ a. mp "),
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTCOLOR);
If (hBmp!=NULL)
{
//get the bitmap information
BITMAP bmInfo;
GetObject (hBmp, sizeof (bmInfo), & amp; BmInfo);
//create & amp; Elected to the bitmap
HDC hMemDC=CreateCompatibleDC (HDC);
HGDIOBJ hOldBmp=SelectObject (hMemDC hBmp);
//map
BitBlt (HDC, 0, 0, bmInfo bmWidth, bmInfo. BmHeight, hMemDC, 0, 0, SRCCOPY);
//restore bitmap
SelectObject (hMemDC hOldBmp);
//end cleanup
DeleteDC (hMemDC);
DeleteObject (hBmp);
}
EndPaint (hWnd, & amp; Ps);
break;
}
Case WM_DESTROY:
{
The PostQuitMessage (0);
break;
}
Default:
{
break;
}
}
Return DefWindowProc (hWnd, message, wParam, lParam);
}
CodePudding user response:
BitBlt last one parameter, change the tryThe second question, in the PAINT message in picture image?
CodePudding user response:
Prior to map calls:SetStretchBltMode (hDC, COLORONCOLOR);//prevent color distortion
CodePudding user response:
See you this source codeCodePudding user response: