S
shadow_x
Unregistered / Unconfirmed
GUEST, unregistred user!
[]
本人想做个控件!效果和ACDsee的缩约图一样,可以被选中。
思路是:在panel上放image,statictext.
image 用来放图片的缩约图,statictext显示图像文件名。
我想问:可以这样实现吗?
下面是几行代码,我还不能初始化很多东西!
求高手 帮忙!!!
unit imagepanel
TImagepanel = class(TPanel)
private
{ Private declarations }
protected
{ Protected declarations }
top_p : integer;
left_p : integer;
bac_color : Tcolor;
image_1: Timage;
panel_1: Tpanel;
statictext_1: Tstatictext;
sta_txt : string;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
Property picture :Timage read image_1 write image_1 default nil; {要显示的image}
Property text :string read sta_txt write sta_txt ; {图形文件的文件名}
Property color : Tcolor read bac_color write bac_color default $00ba8795;
Property top :integer read top_p write top_p default 0;
Property left :integer read left_p write left_p default 0;
end;
procedure Register;
implementation
//------------------------------------------------------------------------------
procedure Register;
begin
RegisterComponents('w3_20', [Timagepanel]);
end;
//------------------------------------------------------------------------------
destructor Timagepanel.Destroy;
begin
statictext_1.free;
image_1.free;
panel_1.free;
inherited destroy;
end;
//------------------------------------------------------------------------------
constructor Timagepanel.Create(AOwner: TComponent);
begin
inherited create(AOwner);
bac_color:=$00ba8795 ;
//----------------初始化 panel_1
panel_1:=TPanel.create(self.owner);
panel_1.parent:=self;
panel_1.Width :=80;
panel_1.Height :=90;
//---------------初始化 statictext_1
statictext_1:=TStatictext.create(self);
statictext_1.Parent:=panel_1; {把statictext置于panel_1上}
statictext_1.Align:=albottom;
statictext_1.Caption:=sta_txt;
statictext_1.color:=bac_color; {置背景颜色}
//---------------初始化 image_1
image_1:=TImage.create(self);
image_1.Parent :=panel_1; {把image_1置于panel_1上}
image_1.Align:=alclient;
end;
//------------------------------------------------------------------------------
end.
本人想做个控件!效果和ACDsee的缩约图一样,可以被选中。
思路是:在panel上放image,statictext.
image 用来放图片的缩约图,statictext显示图像文件名。
我想问:可以这样实现吗?
下面是几行代码,我还不能初始化很多东西!
求高手 帮忙!!!
unit imagepanel
TImagepanel = class(TPanel)
private
{ Private declarations }
protected
{ Protected declarations }
top_p : integer;
left_p : integer;
bac_color : Tcolor;
image_1: Timage;
panel_1: Tpanel;
statictext_1: Tstatictext;
sta_txt : string;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
Property picture :Timage read image_1 write image_1 default nil; {要显示的image}
Property text :string read sta_txt write sta_txt ; {图形文件的文件名}
Property color : Tcolor read bac_color write bac_color default $00ba8795;
Property top :integer read top_p write top_p default 0;
Property left :integer read left_p write left_p default 0;
end;
procedure Register;
implementation
//------------------------------------------------------------------------------
procedure Register;
begin
RegisterComponents('w3_20', [Timagepanel]);
end;
//------------------------------------------------------------------------------
destructor Timagepanel.Destroy;
begin
statictext_1.free;
image_1.free;
panel_1.free;
inherited destroy;
end;
//------------------------------------------------------------------------------
constructor Timagepanel.Create(AOwner: TComponent);
begin
inherited create(AOwner);
bac_color:=$00ba8795 ;
//----------------初始化 panel_1
panel_1:=TPanel.create(self.owner);
panel_1.parent:=self;
panel_1.Width :=80;
panel_1.Height :=90;
//---------------初始化 statictext_1
statictext_1:=TStatictext.create(self);
statictext_1.Parent:=panel_1; {把statictext置于panel_1上}
statictext_1.Align:=albottom;
statictext_1.Caption:=sta_txt;
statictext_1.color:=bac_color; {置背景颜色}
//---------------初始化 image_1
image_1:=TImage.create(self);
image_1.Parent :=panel_1; {把image_1置于panel_1上}
image_1.Align:=alclient;
end;
//------------------------------------------------------------------------------
end.