Einzelnen Beitrag anzeigen

maximi

Registriert seit: 9. Jun 2003
217 Beiträge
 
Delphi 7 Personal
 
#1

Eigene Komponente mit Imagelist.

  Alt 11. Jan 2004, 18:40
Hallo!

Delphi-Quellcode:

unit BorderSkin;

interface

uses
  SysUtils, Classes, Controls, ExtCtrls,forms;

type
  TBorderSkin = class(TImage)
  private
    { Private-Deklarationen }
  protected

    { Protected-Deklarationen }
  public
           Image:Array[1..10] of TImage;
    { Public-Deklarationen }
  published
  procedure load_imagelist(ImageList:TImageList);

    constructor set_koordinaten(Form:TForm);

    { Published-Deklarationen }
  end;

procedure Register;

implementation

constructor TBorderSkin.set_koordinaten;
var I:Integer;
begin
  for i := 1 to 10 do
  begin
    Image[i] := TImage.Create(self);
    Image[i].Parent := Form;
  end;

    //ganz links oben
    if(i = 1) then
    begin
      Image[i].Top := 0;
      Image[i].Width := 5;
      Image[i].Height := 30;
      Image[i].Left := 0;
    end;

    //mitte oben
    if(i = 2) then
    begin
      Image[i].Top := 0;
      Image[i].Width := trunc(1.1648522*(Form.Width-55));;
      Image[i].Height := 32;
      Image[i].Left := 4;
    end;

    //mitte rechts
    if(i = 3) then
    begin
      Image[i].Top := 0;
      Image[i].Width := 45;
      Image[i].Height := 32;
      Image[i].Left := Image[2].Width + 3;
    end;

    if(i = 4) then
    begin
      Image[i].Top := 0;
      Image[i].Width := trunc(7.1333333333*Form.Width-55);
      Image[i].Height := 32;
      Image[i].Left := Image[2].Width + Image[2].Width - 1;
    end;

    if(i = 5) then
    begin
      Image[i].Top := 0;
      Image[i].Width := 5;
      Image[i].Height := 30;
      Image[i].Left := Form.Width-5;
    end;

    if(i = 6) then
    begin
      Image[i].Top := 3;
      Image[i].Width := 21;
      Image[i].Height := 21;
      Image[i].Left := Form.Width-10;
    end;

    if(i = 7) then
    begin
      Image[i].Top := 3;
      Image[i].Width := 21;
      Image[i].Height := 21;
      Image[i].Left := Image[6].Left-31;
    end;

    if(i = 8) then
    begin
      Image[i].Top := 30;
      Image[i].Width := 5;
      Image[i].Height := Form.Height - 32;
      Image[i].Left := 0;
    end;

    if(i = 9) then
    begin
      Image[i].Top := Form.Height-5;
      Image[i].Width := Form.Width-8;
      Image[i].Height := 5;
      Image[i].Left := 4;
    end;

    if(i = 10) then
    begin
      Image[i].Top := 30;
      Image[i].Width := 5;
      Image[i].Height := Form.Height;
      Image[i].Left := Form.Width-5;
    end;
  Form.BorderStyle := bsnone;
end;


procedure TBorderSkin.load_imagelist;
var i:Integer;
begin
  for i := 1 to 10 do
    ImageList.GetBitmap(i,Image[i].Picture.Bitmap);

end;
procedure Register;
begin
  RegisterComponents('Skins', [TBorderSkin]);
end;

end.
Die Procedure TBorderSkin.load_imagelist klappt nicht so wie ich mir das vorstelle. Ich sehe nur immer das erste Image und nicht alle 10!

Danke!
  Mit Zitat antworten Zitat