Domanda

I've found this great component and installed it, it's running great, but I have a slight problem with it. Which unfortunately I don't know how to do it myself.

Can someone help me add a new feature to this component . That would allow it take Images from ImageList ? I would fill up ImageList dynamicaly during my execution time.

Right now I'm doing the following to show a preview of the TILE :

procedure TTools.Preview_ImageExecute(Sender: TObject);
var image_temp : TBitmap;
begin
  image_temp := TBitmap.Create;
  LoadBitMap(ComboBox1.Text,image_temp,Main.ASDb1);
  Image1.Picture.Bitmap:=image_temp;
  image_temp.Free;
end;

Would like to use this somehow with the Image Grid... it should somehow allow me to load all my tiles.. I would use a For loop to fill it up...

Meanwhile I was playing with ListBox, and managed to do this :

procedure TTools.Lst1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var CenterText : integer;
begin
Lst1.Canvas.FillRect(Rect);
Il1.Draw(lst1.Canvas,rect.Left +4, rect.Top +4, Index);
Centertext := (rect.Bottom - rect.Top -lst1.Canvas.TextHeight(text)) div 2;
Lst1.Canvas.TextOut(rect.left + il1.width + 8, rect.Top + CenterText, lst1.Items.Strings[index]);
end;

procedure TTools.Lst1MeasureItem(Control: TWinControl; Index: Integer;
var Height: Integer);
begin
Height := IL1.Height+4;
end;

procedure TTools.Button4Click(Sender: TObject);
var i : integer;
image_temp : TBitmap;
begin
image_temp := TBitmap.Create;


for i:=0 to Main.Images.Count-1 do
  begin
  Lst1.Items.Add(Main.Images.Item[i].Name);
  LoadBitMap(Main.Images.Item[i].Name,image_temp,Main.ASDb1);
  IL1.AddMasked(image_temp, clNone);
end;

Image_temp.Free;
end;

This works, if I have 0 Columns, but I cant get it working with say 4 columns , can someone help ?

Greetings Robert

È stato utile?

Soluzione

Never Mind ... I solved it like this :

procedure TTools.Button4Click(Sender: TObject);
var i : integer;
image_temp : TBitmap;
begin
image_temp := TBitmap.Create;



for i:=0 to Main.Images.Count-1 do
begin
  LoadBitMap(Main.Images.Item[i].Name,image_temp,Main.ASDb1);
  ListView1.Items.Add.Caption:=Main.Images.Item[i].Name;
  ListView1.Items.Item[i].ImageIndex:=i;
  IL1.AddMasked(image_temp, clNone);
end;

Image_temp.Free;
end;

This load's the image names as well as the images from my Asphyre Image list...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top