unit OOToolBar;
interface
uses
Windows, SysUtils, Classes, Controls, ToolWin, ComCtrls, Graphics, Forms;
type
TOOToolBar = class(TToolBar)
//--------------------------------------------------------------------------------------
private
procedure CustomBtnDraw(Sender: TToolBar; Button: TToolButton;State: TCustomDrawState; var DefaultDraw: Boolean);
procedure CustonDraw(Sender: TToolBar;const ARect: TRect; var DefaultDraw: Boolean);
//--------------------------------------------------------------------------------------
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
//--------------------------------------------------------------------------------------
published
{ Published-Deklarationen }
//--------------------------------------------------------------------------------------
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Privat', [TOOToolBar]);
end;
constructor TOOToolBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Flat := True;
ShowCaptions := True;
OnCustomDraw:= CustonDraw;
OnCustomDrawButton:= CustomBtnDraw;
end;
destructor TOOToolBar.Destroy;
begin
inherited Destroy;
end;
procedure TOOToolBar.CustomBtnDraw(Sender: TToolBar; Button: TToolButton;State:TCustomDrawState; var DefaultDraw: Boolean);
var
R,R2: TRect;
begin
R:= Button.BoundsRect;
R2:= Rect(Button.BoundsRect.Left+2,Button.BoundsRect.Top+2,
Button.BoundsRect.Right-2,Button.BoundsRect.Bottom-2);
if cdsSelected in State then
begin
Canvas.Brush.Color:= Color;
Canvas.FillRect(R);
Canvas.Brush.Color:= $00E3DFE0;
Canvas.FillRect(R2);
Canvas.Brush.Style:= bsClear;
Canvas.Pen.Color:= $007A868A;
Canvas.Rectangle(R2);
end
else
if (cdsHot in State) and not (cdsSelected in State) then
begin
Canvas.Brush.Color:= Color;
Canvas.FillRect(R);
Canvas.Brush.Color:= clBlue;
Canvas.FillRect(R2);
Canvas.Brush.Style:= bsClear;
Canvas.Pen.Color:= $00C66931;
Canvas.Rectangle(R2);
end;
Canvas.TextRect(R,4,4,'test');
Canvas.TextRect(R,70,4,'test');
DefaultDraw:= False;
end;
procedure TOOToolBar.CustonDraw(Sender: TToolBar;const ARect: TRect;var DefaultDraw: Boolean);
begin
end;
end.