Arkadaslar bir panel componentine ihtiyacım var sadece su özelligi olsa bana yeter
İmages //imagelist secilecek
imageindex//images secilecek
secilen image paneldeki caption un Hemen Soluna yerleşecek
bir cok panel componentini inceledim bu özelligi bulamadım kendim yapmaya calıstım ama
images i seciyorum imageindex (te iconları göremiyorum) manuel olarak 3 yazsamda icon görünmüyor...
Kodlar burada yardımcı olabilecek arkadaslara simdiden tesekkürler....
Kod: Tümünü seç
unit MYPanel;
interface
uses
Classes, SysUtils, Windows, Graphics, actnlist, ImgList, Controls, ExtCtrls,
Messages,Forms;
type
TMYPanel = class(TPanel)
private
{ Private declarations }
FAbout: String;
ETitle: string;
FImageChangeLink: TChangeLink;
FImages: TCustomImageList;
FImageIndex: TImageIndex;
procedure SetTitle(Value: string);
procedure SetImages(const Value: TCustomImageList);
procedure SetImageIndex(const Value: TImageIndex);
procedure ImageListChange(Sender: TObject);
function Get_About: string;
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
property Title: string read ETitle write SetTitle;
property Images: TCustomImageList read FImages write SetImages;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex;
property About: string read Get_About write FAbout stored False;
end;
procedure Register;
implementation
constructor TMYPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Font.Charset := DEFAULT_CHARSET;
Font.Color := clWhite;
Font.Height := 26;
Font.Name := 'Tahoma';
Font.Style := [fsBold];
FImageIndex := -1;
FImageChangeLink := TChangeLink.Create;
FImageChangeLink.OnChange := ImageListChange;
end;
destructor TMYPanel.Destroy;
begin
inherited Destroy;
end;
procedure TMYPanel.SetTitle(Value: string);
begin
if ETitle <> Value then
begin
ETitle :=Value;
Invalidate;
end;
end;
procedure TMYPanel.ImageListChange(Sender: TObject);
begin
Repaint;
end;
procedure TMYPanel.SetImages(const Value: TCustomImageList);
begin
if Images <> nil then
Images.UnRegisterChanges(FImageChangeLink);
FImages := Value;
if Images <> nil then
begin
if Autosize then
SetBounds(left, top, Images.Width, Images.Height);
Images.RegisterChanges(FImageChangeLink);
Images.FreeNotification(Self);
end;
invalidate;
end;
procedure TMYPanel.SetImageIndex(const Value: TImageIndex);
begin
if FImageIndex <> Value then
begin
FImageIndex := Value;
Invalidate;
end;
end;
function TMYPanel.Get_About: string;
begin
Result :='Abdulkadir LEVENT';
end;
procedure Register;
begin
RegisterComponents('Abdulkadir', [TMYPanel]);
end;
end.