lazarus-ccr/applications/draw_test/mydrawingcontrol.pas
blaszijk 92ca810952 initial import
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2280 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2012-02-09 18:08:48 +00:00

40 lines
709 B
ObjectPascal

unit MyDrawingControl;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Controls, Graphics, LCLType;
type
{ TMyDrawingControl }
TMyDrawingControl = class(TCustomControl)
private
FBitmap: TPortableNetworkGraphic;
public
property Bitmap: TPortableNetworkGraphic read FBitmap write FBitmap;
procedure EraseBackground(DC: HDC); override;
procedure Paint; override;
end;
implementation
procedure TMyDrawingControl.EraseBackground(DC: HDC);
begin
//Uncomment this to enable default background erasing
//inherited EraseBackground(DC);
end;
procedure TMyDrawingControl.Paint;
begin
if Assigned(Bitmap) then
Canvas.Draw(0, 0, Bitmap);
inherited Paint;
end;
end.