unit MFSButton;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Buttons,extctrls;

type
  TMFSButton = class(TSpeedButton)
  private
    { Private declarations }
  protected
    { Protected declarations }
    procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
    procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
    procedure Paint; override;
  public
    { Public declarations }
    Constructor Create(aowner: TComponent); override;
  published
    { Published declarations }
    property Align;
  end;

implementation

Constructor TMFSButton.Create(aowner: TComponent);
Begin
  inherited create(aowner);
  flat := true;
End;

procedure TMFSButton.CMMouseLeave(var Message: TMessage);
begin
  flat := true;
end;

procedure TMFSButton.CMMouseEnter(var Message: TMessage);
begin
  if not enabled then exit;
  flat := false;
end;

procedure TMFSButton.Paint;
var PaintRect : Trect;
DrawFlags : integer;
Begin
  inherited;
  PaintRect := Rect(0, 0, Width, Height);
  if Flat then
  begin
    DrawEdge(Canvas.Handle, PaintRect, BDR_RAISEDINNER,0 or BF_BOTTOMRIGHT);
  end;
end;

end.
