我把它包装了一下:<br>//---------------------------------------------------------------------------<br>// Translucency form<br>bool __fastcall SetLayeredWindowAttributesEx(HWND hWnd, unsigned crKey, Byte bAlpha,unsigned dwFlags)<br>{<br> HINSTANCE DLLHandle;<br> LONG gwlStyle;<br> FSetLayeredWindowAttributes proc;<br><br> bool Result = false;<br> DLLHandle = LoadLibrary("user32.dll");<br> if( DLLHandle != NULL )<br> {<br> proc = (FSetLayeredWindowAttributes)GetProcAddress(DLLHandle,"SetLayeredWindowAttributes");<br> if( proc != NULL )<br> {<br> gwlStyle = GetWindowLong(hWnd,GWL_EXSTYLE);<br> gwlStyle = gwlStyle | WS_EX_LAYERED;<br> SetWindowLong(hWnd,GWL_EXSTYLE,gwlStyle);<br> Result = proc(hWnd,crKey,bAlpha,dwFlags);<br> }<br> FreeLibrary( DLLHandle );<br> }<br> return Result;<br>}<br><br>//使用:窗体关闭时逐渐透明化<br>//---------------------------------------------------------------------------<br>const int iAlphaBlend = 210;<br>//---------------------------------------------------------------------------<br>void __fastcall TSplashForm::FormClose(TObject *Sender,<br> TCloseAction &Action)<br>{<br> Action = caFree;<br><br> for( int i = iAlphaBlend; i > 10; i -= 40 )<br> {<br> if( SetLayeredWindowAttributesEx(Handle,0,i,LWA_ALPHA) == false )<br> break;<br><br> Application->ProcessMessages();<br><br> SleepEx( 10, false );<br> }<br>}