du könntest dir die Komponente TSwitch (die du sicher meinst, Delphi sie aber nicht mitbringt) selber basteln aus einer Panel.
Etwa so:
Delphi-Quellcode:
unit Switch;
interface
uses
SysUtils, Classes, Controls, ExtCtrls;
type
TSwitch =
class(TPanel)
private
bDown: boolean;
procedure Click;
override;
procedure SetState(bValue: boolean);
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
published
property Down: Boolean
read bDown
write SetState;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Beispiele', [TSwitch]);
end;
procedure TSwitch.Click;
begin
if Down=false
then
SetState(true)
else
SetState(false);
end;
procedure TSwitch.SetState(bValue: boolean);
begin
if bValue = true
then
begin
bDown := true;
BevelOuter := bvLowered;
end
else begin
bDown := false;
BevelOuter := bvRaised;
end;
end;
end.
//Edit: Fehlerchen verbessert