c++win 32项目图片显示不出来 代码没报错
部分代码如下编译没有报错图片绘制不出来HBITMAPmap;HDCmyhdc;LRESULTCALLBACKWndProc(HWNDhWnd,UINTmessage,WP...
部分代码如下 编译没有报错 图片绘制不出来
HBITMAP map;
HDC myhdc;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CREATE:
hdc = GetDC(hWnd);
myhdc = CreateCompatibleDC(hdc);
ReleaseDC(hWnd,hdc);
map = (HBITMAP)LoadImage(hInst,L"sss/_coral.bmp",IMAGE_BITMAP,600,230,LR_LOADFROMFILE);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps); // TODO: 在此添加任意绘图代码...
SelectObject(myhdc,map); //hcd缓冲区;
BitBlt(hdc,0,0,600,230,myhdc,0,0,SRCCOPY);
DeleteObject(map);
EndPaint(hWnd, &ps);
break; 展开
HBITMAP map;
HDC myhdc;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
switch (message)
{
case WM_CREATE:
hdc = GetDC(hWnd);
myhdc = CreateCompatibleDC(hdc);
ReleaseDC(hWnd,hdc);
map = (HBITMAP)LoadImage(hInst,L"sss/_coral.bmp",IMAGE_BITMAP,600,230,LR_LOADFROMFILE);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps); // TODO: 在此添加任意绘图代码...
SelectObject(myhdc,map); //hcd缓冲区;
BitBlt(hdc,0,0,600,230,myhdc,0,0,SRCCOPY);
DeleteObject(map);
EndPaint(hWnd, &ps);
break; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询