请问大家如何在窗口的客户区内显示一幅位图,又如何全屏显示位图呢? NULL 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果你用gdiplus 那將是非常容易的事情。去看吧。 void ShowBMP(HWND hWnd, char *filename) //, TCHAR szFileName[MAX_PATH]){ // TCHAR szHello[MAX_LOADSTRING];// LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);// int height, width; PAINTSTRUCT ps; HDC hdc;// HWND hWnd = GetWindow(hWnd, NULL); hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); long lStillWidth = rt.right - rt.left; long lStillHeight = rt.bottom - rt.top; BITMAPINFOHEADER* lpbi = new BITMAPINFOHEADER; BYTE* lpBuf = ReadBMP(lpbi, filename); lpbi = (BITMAPINFOHEADER*)lpBuf; int nW= lpbi->biWidth; int nH= lpbi->biHeight; BYTE* lpData=(BYTE*)lpBuf + sizeof(BITMAPINFOHEADER);// - 10;// + sizeof(RGBQUAD); SetStretchBltMode(hdc, COLORONCOLOR); ::StretchDIBits(hdc,0,0,lStillWidth,lStillHeight,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi,DIB_RGB_COLORS,SRCCOPY);// ::StretchDIBits(hdc,250,250,nW,nH,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi, DIB_RGB_COLORS,SRCCOPY);// DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps);} void ShowBMP(HWND hWnd, char *filename) //, TCHAR szFileName[MAX_PATH]){ // TCHAR szHello[MAX_LOADSTRING];// LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);// int height, width; PAINTSTRUCT ps; HDC hdc;// HWND hWnd = GetWindow(hWnd, NULL); hdc = BeginPaint(hWnd, &ps); // TODO: Add any drawing code here... RECT rt; GetClientRect(hWnd, &rt); long lStillWidth = rt.right - rt.left; long lStillHeight = rt.bottom - rt.top; BITMAPINFOHEADER* lpbi = new BITMAPINFOHEADER; BYTE* lpBuf = ReadBMP(lpbi, filename); lpbi = (BITMAPINFOHEADER*)lpBuf; int nW= lpbi->biWidth; int nH= lpbi->biHeight; BYTE* lpData=(BYTE*)lpBuf + sizeof(BITMAPINFOHEADER);// - 10;// + sizeof(RGBQUAD); SetStretchBltMode(hdc, COLORONCOLOR); ::StretchDIBits(hdc,0,0,lStillWidth,lStillHeight,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi,DIB_RGB_COLORS,SRCCOPY);// ::StretchDIBits(hdc,250,250,nW,nH,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi, DIB_RGB_COLORS,SRCCOPY);// DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER); EndPaint(hWnd, &ps);} 请问如何将一个excel2003文件中的数据导入VC6.0的程序中。 vs2008中TCHAR的输出 如何根据平面坐标建立3维模型,其思想是什么? 请问:如何在VC中建立内嵌Excel表格的控件? 高人救求啊!我在DLL中用不起UpdateData啊,说是未定义啊! 什么是内存泄漏?具个简单的例子来看看~~!谢谢 为什么windows下程序的内存占用会那么大? 如何制作一个类似VB窗体编辑器的东东 哪里有体系结构方面的书下载? 一个关于Dlg的初始化连接报错,求助 写二进制文件的问题 图形问题?
去看吧。
{
// TCHAR szHello[MAX_LOADSTRING];
// LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
// int height, width; PAINTSTRUCT ps;
HDC hdc;
// HWND hWnd = GetWindow(hWnd, NULL);
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
RECT rt;
GetClientRect(hWnd, &rt); long lStillWidth = rt.right - rt.left;
long lStillHeight = rt.bottom - rt.top;
BITMAPINFOHEADER* lpbi = new BITMAPINFOHEADER;
BYTE* lpBuf = ReadBMP(lpbi, filename);
lpbi = (BITMAPINFOHEADER*)lpBuf; int nW= lpbi->biWidth;
int nH= lpbi->biHeight;
BYTE* lpData=(BYTE*)lpBuf + sizeof(BITMAPINFOHEADER);// - 10;// + sizeof(RGBQUAD);
SetStretchBltMode(hdc, COLORONCOLOR);
::StretchDIBits(hdc,0,0,lStillWidth,lStillHeight,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi,DIB_RGB_COLORS,SRCCOPY);// ::StretchDIBits(hdc,250,250,nW,nH,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi, DIB_RGB_COLORS,SRCCOPY);// DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
}
{
// TCHAR szHello[MAX_LOADSTRING];
// LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
// int height, width; PAINTSTRUCT ps;
HDC hdc;
// HWND hWnd = GetWindow(hWnd, NULL);
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
RECT rt;
GetClientRect(hWnd, &rt); long lStillWidth = rt.right - rt.left;
long lStillHeight = rt.bottom - rt.top;
BITMAPINFOHEADER* lpbi = new BITMAPINFOHEADER;
BYTE* lpBuf = ReadBMP(lpbi, filename);
lpbi = (BITMAPINFOHEADER*)lpBuf; int nW= lpbi->biWidth;
int nH= lpbi->biHeight;
BYTE* lpData=(BYTE*)lpBuf + sizeof(BITMAPINFOHEADER);// - 10;// + sizeof(RGBQUAD);
SetStretchBltMode(hdc, COLORONCOLOR);
::StretchDIBits(hdc,0,0,lStillWidth,lStillHeight,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi,DIB_RGB_COLORS,SRCCOPY);// ::StretchDIBits(hdc,250,250,nW,nH,0,0,nW,nH,lpData,(BITMAPINFO*)lpbi, DIB_RGB_COLORS,SRCCOPY);// DrawText(hdc, szHello, strlen(szHello), &rt, DT_CENTER);
EndPaint(hWnd, &ps);
}