Put 2 TEdit's somewhere on your form and name one ThumbHeight1 and the other ThumbWidth1, Add 2 UpDown components next to the TEdit's and associate them to the TEdits. Then add this code:
procedure TForm1.ThumbHeight1Change(Sender: TObject);
begin
ImageEnMView1.ThumbHeight := StrToIntDef(ThumbHeight1.Text, 75);
ImageEnMView1.Update;
end;
procedure TForm1.ThumbWidth1Change(Sender: TObject);
begin
ImageEnMView1.ThumbWidth := StrToIntDef(ThumbWidth1.Text, 125);
ImageEnMView1.Update;
end;
The spacing is controlled by the width of the ImageEnMView, the ThumbWidth and ThumbHeight. When you adjust the ThumbWidth and ThumbWHeight the spacing between the thumbnail will change.
You can also control the specing with HorzBorser and VertBorder properties. In your case with one row of images it works nicely as well:
procedure TForm1.HorzBorder1Change(Sender: TObject);
begin
ImageEnMView1.HorizBorder := StrToIntDef(HorzBorder1.Text, 4);
ImageEnMView1.Update;
end;
Also you do not have to use a loop to set the caption properties. Just put some code in the
the ImageEnMView1BeforeImageDraw event:
procedure TForm1.ImageEnMView1BeforeImageDraw(Sender: TObject; idx, Left, Top: Integer;
Canvas: TCanvas);
var
iDimensions: string;
iBitDepth: integer;
iColors: string;
begin
if FileExists(ImageEnMView1.MIO.Params[idx].FileName) then
begin
iDimensions := IntToStr(ImageEnMView1.MIO.Params[idx].Width) + ' x ' +
IntToStr(ImageEnMView1.MIO.Params[idx].Height);
iBitDepth := ImageEnMView1.MIO.Params[idx].BitsPerSample *
ImageEnMView1.MIO.Params[idx].SamplesPerPixel;
if iBitDepth = 32 then
iColors := ' RGBA' + IntToStr(iBitDepth) + '-bit'
else
iColors := ' RGB' + IntToStr(iBitDepth) + '-bit';
ImageEnMView1.ImageTopText[idx].Caption := iDimensions + iColors;
ImageEnMView1.ImageInfoText[idx].Caption := 'DPI: ' +
IntToStr(ImageEnMView1.MIO.Params[idx].Dpi);
ImageEnMView1.ImageBottomText[idx].Caption :=
ExtractFilename(ImageEnMView1.MIO.Params[idx].FileName);
end;
end;
The BeforeImageDraw event is executed after the ImageEnMView is filled, for each thumbnail in the ImageEnMView.
William Miller
