本程序以后可能要写入手记,故不能用mfc,真烦!
求高手指教
郁闷的人.
求高手指教
郁闷的人.
解决方案 »
- 关于windows API中的函数FindFirstFile和FindNextFile,还有就是CFileFind类下的FindFile和FindNextFile?
- missing storage-class or type specifiers错误
- 一个关于自定义new的问题
- mfc应用程序中datagridview控件是灰色的?
- ATL新手求救
- 读10K-100K的文件到内存,是否一定要进行内存映射?
- 如何将一个char[max]的数组的内容拷贝的 CString类型的变量里去
- 使用应用路由服务器对通讯效率的影响程度?
- 救急!!!!VC++数据库高手们快帮帮我!!!
- 对话框的 小问题? 你注意到了吗?
- 寻求《COM技术内幕》光盘资料的下载
- Windows变成如何创建快捷方式??
你是说wince的吧?MFC也可以啊.呵呵有for ce的MFC可以在wm_paint中把位图bitblt到窗口的DC上
也可以在WM_ERASEBKGND中做.
BOOL CMainForm::Process(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int nRet = 0; switch (message)
{
case ......
.... case WM_ERASEBKGND :
{
HDC hdc = ::GetDC(this->mhWnd); // handle to device context
HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP); HDC hCompadc = ::CreateCompatibleDC(hdc);
::SelectObject(hCompadc,hbitmap);
::GetClientRect(this->mhWnd,&rect);
::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
::StretchBlt(::GetDC(this->mhWnd),0,0,rect.right,rect.top,hCompadc,0,0, );
} }
.........;........;
}
{
HDC hdc = ::GetDC(this->mhWnd); // handle to device context
HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP); HDC hCompadc = ::CreateCompatibleDC(hdc);
::SelectObject(hCompadc,hbitmap);
::GetClientRect(this->mhWnd,&rect);
::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
}
{
HDC hdc = ::GetDC(this->mhWnd); // handle to device context
HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP); HDC hCompadc = ::CreateCompatibleDC(hdc);
::SelectObject(hCompadc,hbitmap);
::GetClientRect(this->mhWnd,&rect);
::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
}
HDC hdc = ::GetDC(hWnd); HBITMAP hbitmap = ::LoadBitmap(CGlobal::gInstance,(LPCTSTR)IDB_BKGMAP); HDC hCompadc = ::CreateCompatibleDC(hdc);
::SelectObject(hCompadc,hbitmap);
::GetClientRect(hWnd,&rect);
::BitBlt(hdc,0,0,rect.right,rect.top,hCompadc,0,0,SRCCOPY);
小弟在WM_ERASEBKGND,WM_PAINT 中均试过了.就是显示不出来.不知为何.难到
脱离了微软的MFC,程序员对windows界面开发就这么难!
已经解决问题,正如(_foo(void)//莫名函数)兄所言,
"rect.right,rect.top 有问题" 正确应是,rect.right-rect.left, rect.bottom-rect.top
原来用MFC 只需rect.Width(),rect.Height()即可.
但现在用api就不行了.其主要原因是英语还需加强.
BOOL BitBlt(
HDC hdcDest, // handle to destination device context
int nXDest, // x-coordinate of destination rectangle's upper-left
// corner
int nYDest, // y-coordinate of destination rectangle's upper-left
// corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
HDC hdcSrc, // handle to source device context
int nXSrc, // x-coordinate of source rectangle's upper-left
// corner
int nYSrc, // y-coordinate of source rectangle's upper-left
// corner
DWORD dwRop // raster operation code
);
真诚感谢大家再次相助,特别是(_foo(void)//莫名函数)大侠.
常见.
快乐的人.