Código
// Faça 2 botoes
{primeiro botao}
procedure TForm1.Button1Click(Sender: TObject);
procedure (sua escolha);
const
WS_EX_LAYERED = $00080000;
LMA_COLORKEY = $00000001;
LMA_ALPHA = $00000002;
type
TLayerFunc = function(hwnd : HWND; crKey : COLORREF; bAlpha : BYTE; dwFlags : DWORD) : boolean; stdcall;
var
ExtStyle : LongInt;
LayerFunc : TLayerFunc;
LibHandle : HModule;
begin
LibHandle := LoadLibrary(user32);
if LibHandle > 0 then
begin
LayerFunc := GetProcAddress(LibHandle, 'SetLayeredWindowAttributes');
if Assigned(LayerFunc) then
begin
ExtStyle := GetWindowLong(Handle, GWL_EXSTYLE);
SetWindowLong(Handle, GWL_EXSTYLE, ExtStyle or WS_EX_LAYERED);
LayerFunc(Handle, rgb(255,0,0), strtoint(edit1.text) {EDIT CRIADO} , LMA_ALPHA or LMA_COLORKEY);
end;
FreeLibrary(LibHandle);
end;
end;
//Coloque 1 valor de 1 à 250 no edit1, esse valor sera responsável pelo alpha do form e clique no botão.
//Qualquer dúvida ou melhora do código, deixe comentários.
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009