在桌面上画图 在桌面上画图,只要几个API函数既可以实现,下面给出在C++BUILDER中具体的方法如下: 1、在头文件中定义变量 Private: Graphics::TBitmap *bmp; 2、图象变量的初始化: bmp=new Graphics::TBitmap(); bmp->LoadFromFile("c:\\AboutLogo.bmp"); 3、在Paint的事件中 void __fastcall TForm1::FormPaint(TObject *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下实现
|