-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathExtCtrls.pas
90 lines (73 loc) · 2.39 KB
/
ExtCtrls.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
Unit ExtCtrls;
{
LVCL - Very LIGHT VCL routines
------------------------------
Tiny replacement for the standard VCL ExtCtrls.pas
Just put the LVCL directory in your Project/Options/Path/SearchPath
and your .EXE will shrink from 300KB to 30KB
Notes:
- implements TImage
- compatible with the standard .DFM files.
- only use existing properties in your DFM, otherwise you'll get error on startup
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
The Initial Developer of the Original Code is Arnaud Bouchez.
This work is Copyright (C) 2008 Arnaud Bouchez - http://bouchez.info
Emulates the original Delphi/Kylix Cross-Platform Runtime Library
(c)2000,2001 Borland Software Corporation
Portions created by Paul Toth are Copyright (C) 2001 Paul Toth. http://tothpaul.free.fr
All Rights Reserved.
}
interface
uses
SysUtils, Classes, Controls, Graphics;
type
TImage = class(TGraphicControl)
private
fPicture: TPicture;
function GetPicture: TPicture;
protected
function SubProperty(const Name: string): TPersistent; override;
public
destructor Destroy; override;
procedure Paint; override;
property Picture: TPicture read GetPicture;
end;
implementation
destructor TImage.Destroy;
begin
fPicture.Free;
inherited;
end;
function TImage.GetPicture:TPicture;
begin
if fPicture=nil then
fPicture := TPicture.Create;
result := fPicture;
end;
function TImage.SubProperty(const Name: string):TPersistent;
const
TPictureSubProperties: array[0..0] of PChar =(
'Picture'
);
begin
case StringIndex(Name,TPictureSubProperties) of
0 : result := Picture;
else result := inherited SubProperty(Name);
end;
end;
procedure TImage.Paint;
begin
if (fPicture=nil) or not fVisible then
inherited else
fPicture.DrawRect(ClientRect,Canvas); // not VCL standard, but works for BITMAP
end;
initialization
RegisterClasses([TImage]);
end.