Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[3.142.98.108] |
|
Сообщ.
#1
,
|
|
|
а можно ли как-нибудь создать тень под окном, чтобы она затемняла то, что в неё попадает?
|
Сообщ.
#2
,
|
|
|
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure FormPaint(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } Desktop : TBitmap; procedure WMActivate( var M : TWMActivate ); message WM_ACTIVATE; public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} function Shadow( RGB : TColor; Intensity : Integer ): TColor; const Masks : array[1..10] of Byte = (100,90,80,80,80,80,80,70,60,50); var R, G, B : Integer; begin R := GetRValue( RGB ) * Masks[Intensity] div 100; G := GetGValue( RGB ) * Masks[Intensity] div 100; B := GetBValue( RGB ) * Masks[Intensity] div 100; Result := ( R shl 16 ) or ( G shl 8 ) or B; end; procedure TForm1.WMActivate( var M : TWMActivate ); begin inherited; if M.Active = WA_INACTIVE then Close; end; procedure TForm1.FormCreate(Sender: TObject); begin BorderStyle := bsNone; DeskTop := TBitmap.Create; DeskTop.Width := Width; DeskTop.Height := Height; end; procedure TForm1.FormDestroy(Sender: TObject); begin DeskTop.Free; end; procedure TForm1.FormPaint(Sender: TObject); begin Canvas.Draw( 0, 0, DeskTop ); end; procedure TForm1.FormShow( Sender: TObject); var DeskDC : hDC; DeskCan : TCanvas; I, J : Integer; begin SetActiveWindow( Handle ); DeskDC := GetDC( GetDeskTopWindow ); DeskCan := TCanvas.Create; try DeskCan.Handle := DeskDC; with DeskTop.Canvas do begin CopyRect( Bounds( 0, 0, Width, Height ), DeskCan, Bounds( Left, Top, Width, Height ) ); Brush.Color := Color; FillRect( Bounds( 0, 0, Width - 10, Height - 10) ); Rectangle( 0, 0, Width - 10, Height - 10 ); for I := 0 to Width do for J := 1 to 10 do if ( I > 8 ) and ( Width - I > J ) then Pixels[I,Height-J] := Shadow( Pixels[I,Height-J], J ); for I := 0 to Height do for J := 1 to 10 do if ( I > 8 ) and ( Height - I >= J ) then Pixels[Width-J,I] := Shadow( Pixels[Width-J,I], J ); end; finally DeskCan.Free; end; end; procedure TForm1.Button1Click(Sender: TObject); begin Close; end; end. |
Сообщ.
#3
,
|
|
|
Спасибо большое, Один Бог
|