forked from groehner/JavaEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUImageTransparent.pas
More file actions
48 lines (36 loc) · 1.09 KB
/
UImageTransparent.pas
File metadata and controls
48 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
unit UImageTransparent;
interface
uses
{$IFNDEF LCL} Windows, Messages, {$ELSE} LclIntf, LMessages, LclType, {$ENDIF}
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;
type
TImageTransparent = class (TImage)
private
procedure CnCtlColorStatic (var Msg: TWMCtlColorStatic); message CN_CTLCOLORSTATIC;
procedure WmEraseBkgnd (var Msg: TWMEraseBkgnd); message WM_ERASEBKGND;
protected
procedure Paint; override;
procedure CreateParams (var Params: TCreateParams); override;
end;
implementation
procedure TImageTransparent.CreateParams (var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end;
procedure TImageTransparent.WmEraseBkgnd(var Msg: TWMEraseBkgnd);
begin
Msg.Result := 1;
end;
procedure TImageTransparent.CnCtlColorStatic(var Msg: TWMCtlColorStatic);
begin
SetBKMode (Msg.ChildDC, TRANSPARENT);
Msg.Result := GetStockObject (NULL_BRUSH);
end;
procedure TImageTransparent.Paint;
begin
SetBKMode (Handle, TRANSPARENT);
//inherited;
end;
end.