-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUDoubleBufferedFrame.pas
More file actions
47 lines (35 loc) · 913 Bytes
/
UDoubleBufferedFrame.pas
File metadata and controls
47 lines (35 loc) · 913 Bytes
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
unit UDoubleBufferedFrame;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TDoubleBufferedFrame = class(TFrame)
PaintBox1: TPaintBox;
private
{ Private declarations }
protected
procedure CanvasPaint(aCanvas: TCanvas); virtual; abstract;
public
{ Public declarations }
procedure Redraw();
constructor Create(AOwner: TComponent); override;
end;
implementation
{$R *.dfm}
{ TFrame1 }
constructor TDoubleBufferedFrame.Create(AOwner: TComponent);
begin
inherited;
end;
procedure TDoubleBufferedFrame.Redraw();
begin
var canvas := TBitmap.Create(PaintBox1.Canvas.ClipRect.Width, PaintBox1.Canvas.ClipRect.Height);
try
CanvasPaint(canvas.Canvas);
PaintBox1.Canvas.Draw(0, 0, canvas);
finally
FreeAndNil(canvas);
end;
end;
end.