用C++ Builder在桌面上画图 (转)[@more@]在桌面上画图
在桌面上画图,只要几个
api函数既可以实现,下面给出在C++BUILDER中具体的方法如下:
1、在头
文件中定义变量
Private:
Graphics::TBitmap *bmp;
2、图象变量的初始化:
bmp=new Graphics::TBitmap();
bmp->LoadFromFile("c:AboutLogo.bmp");
3、在Paint的事件中
void __fastcall TForm1::FormPaint(T
object *Sender)
{
HDC hdk;
TRect rect;
Application->Minimize();
hdk=GetWindowDC(GetDesktopWindow());
GetWindowRect(GetDesktopWindow(),&rect);
BitBlt(hdk,(rect.Width()-bmp->Width)/2,(rect.Height()-bmp->Height)/2,bmp->Width,bmp->Height,bmp->Canvas->Handle,0,0,SRCCOPY);
}
4。销毁TBitmap
对象 delete bmp;
以上
程序在C++ Builder 5+WINNT 4.0下实现
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10790690/viewspace-957002/
,如需转载,请注明出处,否则将追究法律责任。