如何让表单模糊

时间:2015-04-29 01:36:29

标签: freepascal lazarus

我在拉撒路创造了一个表格。我希望它模糊,不透明。我找到了这段代码

    function SetLayeredWindowAttributes (hWnd:Longint; Color:Longint; X:Byte; alpha:Longint):bool stdcall; external 'USER32';
    Function SetWindowLongA (hWnd:Longint; nIndex:longint; dwNewLong:longint):longint stdcall; external 'USER32';
    Function GetWindowLongA ( hWnd:Longint; nIndex:longint):longint stdcall; external 'user32';

const
  LWA_COLORKEY = 1;
  LWA_ALPHA = 2;
  LWA_BOTH = 3;
  WS_EX_LAYERED = $80000;
  GWL_STYLE = -16;  

var
  Form1: TForm1;


implementation  

procedure SetTranslucent(ThehWnd: Longint; Color: Longint; nTrans: Integer);
var
attrib:longint;
begin
  attrib := GetWindowLongA(ThehWnd, GWL_STYLE);
  SetWindowLongA (ThehWnd, GWL_EXSTYLE, attrib Or WS_EX_LAYERED);
  SetLayeredWindowAttributes (ThehWnd, Color, nTrans,1);
end; 

procedure TForm1.FormCreate(Sender: TObject);
begin
// borderStyle := BsNone
  SetTranslucent (form1.Handle, $00836B74 , 0);

end;         

但是这段代码使我的表单透明。

我该如何解决?

0 个答案:

没有答案