Delphi Dünyası Facebook'ta

Kodbank İndir

! CODEBANK 2012 !

İNDİRMEK&DETAYLI BİLGİ ALMAK İÇİN BURAYI TIKLAYINIZ.

Gönderen Konu: Form - Transparent/Untransparent  (Okunma sayısı 1366 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı CMNSOFT

  • Delphi 2 Level 4
  • ****
  • İleti: 82
  • Rep: +2/-2
  • Cinsiyet: Bay
    • http://www.cmnsoft.com
Form - Transparent/Untransparent
« : 21 Ekim 2005 16:20:27 »
Kod:  (Unknown Language)
  1. private
  2.     { Private declarations }
  3.     FullRgn, ClientRgn, CtlRgn: THandle;
  4.     procedure MakeTransparent;
  5.     procedure UndoTransparent;
  6.   end;
  7.  
  8. {...}
  9.  
  10. implementation
  11.  
  12. {...}
  13.  
  14. procedure TForm1.MakeTransparent;
  15. var
  16.   AControl: TControl;
  17.   A, Margin, X, Y, CtlX, CtlY: Integer;
  18. begin
  19.   Margin    := (Width - ClientWidth) div 2;
  20.   FullRgn   := CreateRectRgn(0, 0, Width, Height);
  21.   X         := Margin;
  22.   Y         := Height - ClientHeight - Margin;
  23.   ClientRgn := CreateRectRgn(X, Y, X + ClientWidth, Y + ClientHeight);
  24.   CombineRgn(FullRgn, FullRgn, ClientRgn, RGN_DIFF);
  25.   for A := 0 to ControlCount - 1 do
  26.   begin
  27.     AControl := Controls[A];
  28.     if (AControl is TWinControl) or (AControl is TGraphicControl) then with AControl do
  29.       begin
  30.         if Visible then
  31.         begin
  32.           CtlX   := X + Left;
  33.           CtlY   := Y + Top;
  34.           CtlRgn := CreateRectRgn(CtlX, CtlY, CtlX + Width, CtlY + Height);
  35.           CombineRgn(FullRgn, FullRgn, CtlRgn, RGN_OR);
  36.         end;
  37.       end;
  38.   end;
  39.   SetWindowRgn(Handle, FullRgn, True);
  40. end;
  41.  
  42. procedure TForm1.UndoTransparent;
  43. begin
  44.   FullRgn := CreateRectRgn(0, 0, Width, Height);
  45.   CombineRgn(FullRgn, FullRgn, FullRgn, RGN_COPY);
  46.   SetWindowRgn(Handle, FullRgn, True);
  47. end;



Kullanım Şekli
Kod:  (Unknown Language)
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   MakeTransparent
  4. end;
  5.  
  6. procedure TForm1.Button1Click(Sender: TObject);
  7. begin
  8.   UndoTransparent
  9. end;
« Son Düzenleme: 19 Haziran 2009 02:18:55 by Kocaturk »
:::::::::::::::::::: www.CMNSOFT.com ::::::::::::::::::::