【问题标题】:Image Grid by NGLNNGLN 的图像网格
【发布时间】:2012-12-29 21:44:30
【问题描述】:

我找到了这个很棒的组件并安装了它,它运行良好,但我有一个小问题。不幸的是,我自己不知道该怎么做。

谁能帮我为这个组件添加一个新功能。那将允许它从 ImageList 获取图像吗?我会在执行期间动态填充 ImageList。

现在我正在执行以下操作以显示 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;

想以某种方式将其与图像网格一起使用...它应该以某种方式允许我加载所有图块..我会使用 For 循环来填充它...

与此同时,我在玩 ListBox,并设法做到了这一点:

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;

这行得通,如果我有 0 列,但我不能让它与 4 列一起工作,有人可以帮忙吗?

问候 罗伯特

【问题讨论】:

  • 罗伯特,您应该将您的答案作为答案发布,而不是作为对您问题的编辑。您甚至希望在几天后将其标记为已接受的答案。

标签: image gridview dynamic delphi-7 imagelist


【解决方案1】:

没关系...我是这样解决的:

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;

此加载是图像名称以及我的 Asphyre 图像列表中的图像...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-13
    • 2011-05-30
    • 2013-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多