also ich habe soviel geschaft
Delphi-Quellcode:
unit Switch;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls;
type
TSwitch =
class(TPanel)
private
bDown : boolean;
bHeight : Integer;
bhohe: Integer;
procedure Click;
procedure SetState(bValue: boolean);
protected
{ Protected-Deklarationen}
public
{ Public-Deklarationen}
published
property Down : Boolean
read bDown
write SetState;
property Höhe1: Integer
read bHeight
write bHeight;
property Höhe1: Integer
read bhohe
write bhohe;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Beispiele', [TSwitch]);
end;
procedure TSwitch.Click;
begin
if bHeight = Height
then
begin
Height := bhohe;
bDown := true
end
else
begin
Height := bHeight;
bDown := false
end;
end;
procedure TSwitch.SetState(bValue: boolean);
begin
if bValue = true
then
begin
bDown := true;
Height := Height;
end
else
begin
bDown := false;
Height := bHeight;
end
end;
end.
Das bild das ich im attachment hinzugefügt habe, zeigt wie es am ende aussehen soll.