forked from JBontes/Life32
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPasteRect.pas
99 lines (88 loc) · 2.19 KB
/
PasteRect.pas
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
unit PasteRect;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TPasteRect = class(TCustomControl)
private
{ Private declarations }
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPaint;
procedure Paint; override;
public
{ Public declarations }
published
property DragMode;
property DragCursor;
property Cursor;
property ShowHint;
property ParentShowHint;
property OnEndDrag;
property OnStartDrag;
property OnDragDrop;
property OnDragOver;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Johan', [TPasteRect]);
end;
procedure TPasteRect.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do begin
ExStyle:= ExStyle or WS_EX_TRANSPARENT or WS_EX_TOPMOST;
Style:= Style or WS_THICKFRAME or WS_CHILD or WS_VISIBLE;
WindowClass.Style:= WindowClass.Style or CS_HREDRAW or CS_VREDRAW;
end; {with}
Brush.Color:= clInfoBk;
end;
procedure TPasteRect.WMNCPaint(var Msg: TWMNCPaint);
var
MyDC: HDC;
MyPen: HPen;
OldPen: HPen;
//Dummy: TPoint;
begin
(*MyDC:= GetWindowDC(Handle);
try
MyPen:= CreatePen(PS_SOLID,2,clBlack);
try
OldPen:= SelectObject(MyDC,MyPen);
MoveToEx(MyDC,1,1,nil);
LineTo(MyDC,1,Height-1); LineTo(MyDC,Width-1,Height-1);
LineTo(MyDC,Width-1,1); LineTo(MyDC,1,1);
finally begin
SelectObject(MyDC,OldPen);
DeleteObject(MyPen);
end; {finally}
end; {try}
finally ReleaseDC(Handle,MyDC);
end; *){try}
end;
procedure TPasteRect.Paint;
var
MyDC: HDC;
MyPen: HPen;
OldPen: HPen;
begin
MyDC:= GetWindowDC(Handle);
try
MyPen:= CreatePen(PS_SOLID,2,clBlack);
try
OldPen:= SelectObject(MyDC,MyPen);
MoveToEx(MyDC,1,1,nil);
LineTo(MyDC,1,Height-1); LineTo(MyDC,Width-1,Height-1);
LineTo(MyDC,Width-1,1); LineTo(MyDC,1,1);
finally begin
SelectObject(MyDC,OldPen);
DeleteObject(MyPen);
end; {finally}
end; {try}
finally ReleaseDC(Handle,MyDC);
end; {try}
//ValidateRect(Handle,nil);
end;
end.