对话框上贴张位图后,当窗口被覆盖再移走,如何自动恢复位图? 画图程序没错,我按书上写的,而且CBitmapButton创建的按钮也没有重绘,怎办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不会呀,在OnPaint()中写的一定会重会的 onDraw(CDC* pDC ) ;{ // 保存绘图工具 int iOldDC = pDC->SaveDC() ; // 绘图代码 CBitmap bmpFile ; if ( bmpFile.LoadBitmap( IDB_BITMAP1 ) ) { BITMAP bmpInfo; bmpFile.GetBitmap(&bmpInfo); // Create an in-memory device context compatible with the // display device context that is used to paint. CDC dcMemory; dcMemory.CreateCompatibleDC(pDC); // Select the bitmap into the in-memory device context. CBitmap* pOldBitmap = dcMemory.SelectObject(&bmpFile); pDC->BitBlt(rect.left , rect.top , bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 0, 0, SRCCOPY); dcMemory.SelectObject(pOldBitmap); } // 回复原来的绘图工具 pDC->RestoreDC( iOldDC ) ;} 调用该函数:他会强制重新绘制整个客户区Invalidate();如还不行就加上:UpdateWindow(); 常用C++网址 开发win ce6.0 下的软件问题 mscomm控件的使用 如何在VC++6.0的Tab控件中放入ListCtl控件 为什么我printf就能用,而fprintf打印的却是一片空白?? !!!Help!请问Direct3D如何渲染中文? test一下 大哥 大姐都进来看看帮帮小弟 !!!!! win98作DCOM服务器要做那些设置?sos MFC程序中的各个类的互访? 关于<<如何切换视口而不破坏它们?>>的问题!! 大家看看这个代码,怎么画出的是实线?
{
// 保存绘图工具
int iOldDC = pDC->SaveDC() ; // 绘图代码
CBitmap bmpFile ;
if ( bmpFile.LoadBitmap( IDB_BITMAP1 ) )
{
BITMAP bmpInfo;
bmpFile.GetBitmap(&bmpInfo); // Create an in-memory device context compatible with the
// display device context that is used to paint.
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC); // Select the bitmap into the in-memory device context.
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmpFile);
pDC->BitBlt(rect.left , rect.top , bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 0, 0, SRCCOPY); dcMemory.SelectObject(pOldBitmap);
} // 回复原来的绘图工具
pDC->RestoreDC( iOldDC ) ;
}
Invalidate();
如还不行就加上:
UpdateWindow();