unit MyButtons;
interface
uses
SysUtils, Classes, Controls, Graphics;
type
Wechselbutton =
class(TCustomControl)
private
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
Procedure Paint;
override;
public
{ Public-Deklarationen }
published
{ Published-Deklarationen }
Procedure LoadImg_normal(Pfad:
String);
Procedure LoadImg_MouseDown(Pfad:
String);
Procedure LoadImg_disabled(Pfad:
String);
end;
procedure Register;
var
Img_normal :TBitmap;
Img_MouseDown :TBitmap;
Img_disabled :TBitmap;
b_Enabled :Boolean;
b_MouseDown :Boolean;
implementation
procedure Wechselbutton.Paint;
begin
If b_Enabled
then
Begin
If b_MouseDown
then
Begin
{Width := Img_MouseDown.Width;
Height := Img_MouseDown.Height; }
Canvas.Draw(0,0,Img_MouseDown);
End
Else
Begin
{Width := Img_normal.Width;
Height := Img_normal.Height;}
Canvas.Draw(0,0,Img_normal);
End;
End
Else
Begin
{Width := Img_disabled.Width;
Height := Img_disabled.Height;}
Canvas.Draw(0,0,Img_disabled);
End;
end;
procedure Wechselbutton.LoadImg_normal(Pfad :
String);
begin
Img_normal := TBitmap.Create;
try
Img_normal.LoadFromFile(Pfad);
except
Img_normal.Free;
end;
end;
Procedure Wechselbutton.LoadImg_MouseDown(Pfad:
String);
begin
Img_MouseDown := TBitmap.Create;
try
Img_MouseDown.LoadFromFile(Pfad);
except
Img_MouseDown.Free;
end;
end;
Procedure Wechselbutton.LoadImg_disabled(Pfad:
String);
begin
Img_disabled := TBitmap.Create;
try
Img_disabled.LoadFromFile(Pfad);
except
Img_disabled.Free;
end;
end;
//*****************
//*****************
//*****************
procedure Register;
begin
RegisterComponents('
Beispiele', [MyButtons.Wechselbutton]);
end;
end.