盘绰网教程:是一个免费提供流行视频软件教程、在线学习分享的学习平台!

BCB完成MDI程序背景图

时间:2024/12/22作者:未知来源:盘绰网教程人气:


[摘要]cwMessage->message == WM_ERASEBKGND ) //重画用户窗口DrawBitmap(hClientHandle, hFaceBitmap, iClientHeight,...
cwMessage->message == WM_ERASEBKGND )
{ //重画用户窗口
DrawBitmap(hClientHandle, hFaceBitmap, iClientHeight, iClientWidth);
}
}
if ( hMsgHook != NULL) //将消息继续下传
lReturn = CallNextHookEx(hMsgHook, nCode, wParam, lParam );
return lReturn;
} //卸载钩子函数
void __fastcall TMainForm::FormClose(TObject Sender, TCloseAction &&Action)
{ if ( hMsgHook != NULL)
UnhookWindowsHookEx( hMsgHook );
if ( Face != NULL )
delete Face;
}
//在指定的窗口中,画位图,填充整个用户窗口
//Ture为绘制成功,false为绘制失败
BOOL DrawBitmap(HWND Handle, HBITMAP hBitmap, int iClientHeight, int iClientWidth)
{ if ( hBitmap == NULL )
return false;
BITMAP b;
int iBitmapH, iBitmapW;
GetObject( hBitmap, sizeof( BITMAP), &&b);
iBitmapH = b.bmHeight;
iBitmapW = b.bmWidth;
int x, y;
HDC hClientDC, hMemDC;
hClientDC = GetDC(Handle);
if ( hClientDC == NULL )
return false;
hMemDC = CreateCompatibleDC( hClientDC );
if ( hMemDC == NULL )
{ DeleteDC( hClientDC );
return false;
}
SelectObject( hMemDC, hBitmap );
x = 0;
while ( x < iClientWidth )
{ y = 0;
while ( y < iClientHeight )
{ClientCanvas->Draw(x, y, Face);
BitBlt( hClientDC, x, y,iBitmapW, iBitmapH, hMemDC, 0, 0,SRCCOPY );
y = y + iBitmapH; }
x = x + iBitmapW; }
DeleteDC( hMemDC );
DeleteDC( hClientDC );
return true; }

将上述C++ Builder代码片段加入用户的MDI软件中即可实现任意的MDI程序背景图

关键词:  BCB完成MDI程序背景图





Copyright © 2012-2018 盘绰网教程(http://www.panchuo.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版