Hi,
mit folgender Funktion erstelle ich eigene Panels:
Delphi-Quellcode:
function AddPicassaPanel(Parent: TPanel; Image, Title: String; OperationsMenu: TPopUpMenu; SubTitle: String = ''; ImageRollOver: String = ''):Boolean;
var
PicassaPanel, PicassaHeader, PicassaContainer, PicassaToolbar : TPanel;
PicassaImage: TImage;
PicassaTitle, PicassaSubTitle, PicassaSelect, PicassaSelectAll, PicassaSelectNone: TLabel;
PicassaBevelTop, PicassaBevelBottom, PicassaSeperator: TBevel;
PicassaOperationsButton: TSpeedButton;
PicassaPanelName: String;
begin
//set name
if PicassaPanels.Count>0 then
begin
PicassaPanelName:='PicassaPanel'+inttostr(PicassaPanels.count);
end
else
begin
PicassaPanelname:='PicassaPanel0';
end;
//create main layer
PicassaPanel:=TPanel.Create(Parent);
PicassaPanel.Name:=PicassaPanelName;
PicassaPanel.Visible:=true;
PicassaPanel.Align:=alTop;
PicassaPanel.Color:=$008E6423;
PicassaPanel.BevelOuter:=bvNone;
PicassaPanel.Height:=208;
//create top bevel
PicassaBevelTop:=TBevel.Create(PicassaPanel);
PicassaBevelTop.Name:=PicassaPanelName+'_BevelTop';
PicassaBevelTop.Align:=alTop;
PicassaBevelTop.Height:=1;
PicassaBevelTop.Shape:=bsBottomLine;
//create header
PicassaHeader:=TPanel.Create(PicassaPanel);
PicassaHeader.name:=PicassaPanelName+'_Header';
PicassaHeader.align:=alTop;
PicassaHeader.BevelOuter:=bvNone;
PicassaHeader.Color:=$008E6423;
PicassaHeader.height:=52;
//create objects on header
//Image
PicassaImage:=TImage.Create(PicassaHeader);
PicassaImage.Name:=PicassaPanelName+'_Image';
PicassaImage.Picture.LoadFromFile(Image);
PicassaImage.height:=48;
PicassaImage.Width:=48;
PicassaImage.Left:=4;
PicassaImage.Top:=4;
PicassaImage.Transparent:=true;
//Title
PicassaTitle:=TLabel.Create(PicassaHeader);
PicassaTitle.Name:=PicassaPanelName+'_Title';
PicassaTitle.Caption:=Title;
PicassaTitle.Left:=56;
PicassaTitle.Top:=4;
PicassaTitle.Font.Color:=clWhite;
PicassaTitle.Font.Name:='Arial';
PicassaTitle.Font.Size:=12;
PicassaTitle.Font.Style:=[fsBold];
//SubTitle
PicassaSubTitle:=TLabel.Create(PicassaHeader);
PicassaSubTitle.Name:=PicassaPanelName+'_SubTitle';
PicassaSubTitle.Caption:=SubTitle;
PicassaSubTitle.Left:=56;
PicassaSubTitle.Top:=26;
PicassaSubTitle.Font.Color:=clWhite;
PicassaSubTitle.Font.Name:='Arial';
PicassaSubTitle.Font.Size:=10;
PicassaSubTitle.Font.Style:=[fsBold];
//Operations-Button
PicassaOperationsButton:=TSpeedButton.Create(PicassaHeader);
PicassaOperationsButton.Name:=PicassaPanelName+'_OperationsButton';
PicassaOperationsButton.Anchors:=[akTop, akRight];
PicassaOperationsButton.Caption:=PicassaOperations;
PicassaOperationsButton.Font.Color:=$008E6423;
PicassaOperationsButton.Font.Name:='Arial';
PicassaOperationsButton.Font.Size:=10;
PicassaOperationsButton.Font.Style:=[fsBold];
PicassaOperationsButton.Height:=22;
PicassaOperationsButton.Layout:=blGlyphRight;
PicassaOperationsButton.Left:=Parent.Width-101;
PicassaOperationsButton.Width:=97;
PicassaOperationsButton.Top:=4;
//create toolbar
PicassaToolbar:=TPanel.Create(PicassaPanel);
PicassaToolbar.Name:=PicassaPanelName+'_Toolbar';
PicassaToolbar.align:=alTop;
PicassaToolbar.BevelOuter:=bvNone;
PicassaToolbar.Color:=$00E0E0E0;
PicassaToolbar.Height:=24;
//create objects on toolbar
PicassaPanels.Add(PicassaPanelName);
end;
Leider sehe ich diese nicht auf meinen Hauptpanel (Parent). Wieso?