Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Array of TBitmap

Posted on 2004-09-24
3
Medium Priority
?
1,045 Views
Last Modified: 2008-02-01
Hi!

I have a TBitmap array with some BMPs; The problem is to access these BMPs (I need to show then in TImage component), because it shows blank.

Can anybody help please?

Thanx.
0
Comment
Question by:nany
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
esoftbg earned 750 total points
ID: 12145144
unit Unit1_Q_21144011;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, ExtDlgs, Buttons, Spin, Tabs;

type
  TForm1 = class(TForm)
    SpeedButton1: TSpeedButton;
    OpenPicDlg: TOpenPictureDialog;
    ImgLoad: TImage;
    ImgArr: TImage;
    Scroller: TScroller;
    procedure SpeedButton1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure ScrollerClick(Sender: TObject);
  private   { Private declarations }
    BMPArr:   array of TBitmap;
  public    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  I:      Integer;
begin
  if OpenPicDlg.Execute then
  begin
    I := Length(BMPArr);
    SetLength(BMPArr, I+1);
    BMPArr[I] := TBitmap.Create;
    BMPArr[I].LoadFromFile(OpenPicDlg.FileName);
    ImgLoad.Picture.Bitmap.Assign(BMPArr[I]);
    if (I=0) then
      ImgArr.Picture.Bitmap.Assign(BMPArr[I]);
    Scroller.Max := I;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  SetLength(BMPArr, 0);
end;

procedure TForm1.FormDestroy(Sender: TObject);
var
  I:      Integer;
begin
  try
    for I := 0 to Length(BMPArr)-1 do
      BMPArr[I].Free;
  finally
    SetLength(BMPArr, 0);
  end;
end;

procedure TForm1.ScrollerClick(Sender: TObject);
var
  I:      Integer;
begin
  I := Scroller.Position;
  ImgArr.Picture.Bitmap.Assign(BMPArr[I]);
end;

end.
0
 

Author Comment

by:nany
ID: 12145406
thanks esoftbg!
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12145536
nany, you are welcome !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question