还不行!!!!!!!!!!!!!!!!!!!!!
代码如下:
unit IDMYpanel;
interface
uses
Graphics,Windows, Messages, SysUtils, StdCtrls, Classes, ComCtrls, CommCtrl,ExtCtrls , Controls ;
type
TMypanel = class(Tpanel)
private
Memo:tMemo;
statusbar:tstatusbar;
procedure ReadOnDragGrop(Sender, Source: TObject; X, Y: Integer);
procedure SetOnDragGrop(Sender, Source: TObject; X, Y: Integer);
Function ReadMemoText():string;
procedure SetMemoText(Const Value:string);
Function ReadMemocolor():Tcolor;
procedure SetMemocolor(Const Value:Tcolor);
Function ReadstatusbarColor():Tcolor;
procedure setstatusbarColor(Const Value:Tcolor);
Function ReadSt1():string;
procedure SetSt1(Const Value:string);
Function ReadSt2():string;
procedure SetSt2(Const Value:string);
Function ReadSt3():string;
procedure SetSt3(Const Value:string);
Function ReadSt4():string;
procedure SetSt4(Const Value:string);
{ Published declarations }
{ Private declarations }
protected
{ Protected declarations }
public
constructor create(AOwner: TComponent); override;
destructor Destroy; override;
{ Public declarations }
published
property MemoText:string read ReadMemoText write SetMemoText;
property St1:string read ReadSt1 write Setst1;
property St2:string read ReadSt2 write Setst2;
property St3:string read ReadSt3 write Setst3;
property St4:string read ReadSt4 write Setst4;
property MemoColor:Tcolor read ReadMemoColor write SetMemoColor;
property statusbarColor:Tcolor read ReadstatusbarColor write SetstatusbarColor;
property OnDragDrop:tdragdropevent read ReadOnDragGrop write SetOnDragGrop;
end;
procedure Register;
implementation
procedure SetOnDragGrop(Sender, Source: TObject; X, Y: Integer);
begin
//
end;
procedure readOnDragGrop(Sender, Source: TObject; X, Y: Integer);
begin
//
end;
Function TMypanel.ReadMemoColor():Tcolor;
begin
Result:=memo.color;
end;
procedure TMypanel.SetMemoColor(Const Value:Tcolor);
begin
Memo.color:=Value;
end;
Function TMypanel.ReadstatusbarColor():Tcolor;
begin
Result:=statusbar.color;
end;
procedure TMypanel.SetstatusbarColor(Const Value:Tcolor);
begin
statusbar.color:=Value;
end;
Function TMypanel.ReadMemoText():string;
begin
Result:=memo.Lines.text;
end;
procedure TMypanel.SetMemoText(Const Value:string);
begin
Memo.Lines.text:=Value;
end;
Function TMypanel.ReadSt1():string;
begin
Result:=statusbar.Panels[0].text;
end;
procedure TMypanel.SetSt1(Const Value:string);
begin
statusbar.Panels[0].text:=Value;
end;
Function TMypanel.ReadSt2():string;
begin
Result:=statusbar.Panels[2].text;
end;
procedure TMypanel.SetSt2(Const Value:string);
begin
statusbar.Panels[2].text:=Value;
end;
Function TMypanel.ReadSt3():string;
begin
Result:=statusbar.Panels[4].text;
end;
procedure TMypanel.SetSt3(Const Value:string);
begin
statusbar.Panels[4].text:=Value;
end;
Function TMypanel.ReadSt4():string;
begin
Result:=statusbar.Panels[5].text;
end;
procedure TMypanel.SetSt4(Const Value:string);
begin
statusbar.Panels[5].text:=Value;
end;
constructor TMypanel.create(AOwner: TComponent);
begin
inherited Create(AOwner);
Memo:=TMemo.Create(Self);
Mem
nDragDrop :=self.OnDragDrop;
Mem
nDragOver :=self.OnDragOver;
Memo.Alignment :=taCenter;
Memo.Font.Size :=self.Font.Size;
Memo.Font.color:=self.Font.color;
Memo.Parent:=self;
memo.Align :=Alclient;
statusbar:=tstatusbar.create(self);
statusbar.Parent :=self;
statusbar.Align :=alBottom;
with statusbar.Panels.Add do //层
width:=20;
with statusbar.Panels.Add do //X
begin
width:=10;
text:='X';
Bevel:=pbNone;
end;
with statusbar.Panels.Add do //长
width:=20;
with statusbar.Panels.Add do //X
begin
width:=10;
text:='X';
Bevel:=pbNone;
end;
with statusbar.Panels.Add do //宽
width:=20;
with statusbar.Panels.Add do //其他
begin
width:=200;
end;
end;
destructor TMypanel.Destroy;
begin
inherited;
end;
procedure Register;
begin
RegisterComponents('Standard', [TMypanel]);
end;
end.