Starts preparring customdrawncontrols.pas for usage inside customdrawnws

git-svn-id: trunk@33868 -
This commit is contained in:
sekelsenmat 2011-11-30 10:33:19 +00:00
parent ec49388044
commit afe0cc0ae5

View File

@ -60,11 +60,11 @@ type
// //
property DrawStyle: TCDDrawStyle read FDrawStyle write SetDrawStyle; property DrawStyle: TCDDrawStyle read FDrawStyle write SetDrawStyle;
public public
//
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure EraseBackground(DC: HDC); override; procedure EraseBackground(DC: HDC); override;
procedure Paint; override; procedure Paint; override;
procedure DrawToCanvas(ACanvas: TCanvas);
end; end;
TCDControlClass = class of TCDControl; TCDControlClass = class of TCDControl;
@ -799,35 +799,37 @@ end;
procedure TCDControl.Paint; procedure TCDControl.Paint;
var var
ABmp: TBitmap; ABmp: TBitmap;
lSize: TSize;
lControlId: TCDControlID;
begin begin
inherited Paint; inherited Paint;
PrepareCurrentDrawer();
{$ifdef CDControlsDoDoubleBuffer} {$ifdef CDControlsDoDoubleBuffer}
ABmp := TBitmap.Create; ABmp := TBitmap.Create;
try try
ABmp.Width := Width; ABmp.Width := Width;
ABmp.Height := Height; ABmp.Height := Height;
lSize := Size(Width, Height); DrawToCanvas(ABmp.Canvas);
lControlId := GetControlId();
PrepareControlState;
PrepareControlStateEx;
FDrawer.DrawControl(ABmp.Canvas, Point(0, 0),
lSize, lControlId, FState, FStateEx);
Canvas.Draw(0, 0, ABmp); Canvas.Draw(0, 0, ABmp);
finally finally
ABmp.Free; ABmp.Free;
end; end;
{$else} {$else}
DrawToCanvas(Canvas);
{$endif}
end;
procedure TCDControl.DrawToCanvas(ACanvas: TCanvas);
var
ABmp: TBitmap;
lSize: TSize;
lControlId: TCDControlID;
begin
PrepareCurrentDrawer();
lSize := Size(Width, Height); lSize := Size(Width, Height);
lControlId := GetControlId(); lControlId := GetControlId();
PrepareControlState; PrepareControlState;
PrepareControlStateEx; PrepareControlStateEx;
FDrawer.DrawControl(Canvas, lSize, lControlId, FState, FStateEx); FDrawer.DrawControl(Canvas, lSize, lControlId, FState, FStateEx);
{$endif}
end; end;
procedure TCDControl.MouseEnter; procedure TCDControl.MouseEnter;