ImageEn, unit iemview

TImageEnMView.SelectedImage

TImageEnMView.SelectedImage


Declaration

property SelectedImage: integer;


Description

Returns or sets the currently selected image.

Note:
Use Deselect to remover selection from an image
The selected image is drawn with a colored border.
To get the bitmap of the selected image, use IEBitmap
The index ignores any active filtering, i.e. SelectedImage := 3; means the fourth image regardless of visibility. See GetUnfilteredImage


Examples

// Show filename of selected image
ShowMessage( ImageEnMView1.ImageFilename[ ImageEnMView1.SelectedImage ]);

// Paint frame number on each thumbnail
ImageEnMView1.LockUpdate();
for I := 0 to ImageEnMView1.ImageCount - 1 do
begin
  ImageEnMView1.SelectedImage := I;
  ImageEnMView1.Proc.TextOut(Align_text_near_top,
                             Align_text_near_left,
                             '#' + IntToStr( I + 1 ),
                             'Arial',
                             32,
                             clRed,
                             [fsBold]);
end;
ImageEnMView1.UnlockUpdate();

// Save only checked images
wasMS := ImageEnMView1.EnableMultiSelect;
try
  ImageEnMView1.LockUpdate();
  ImageEnMView1.EnableMultiSelect := True;

  ImageEnMView1.Deselect();
  ImageEnMView1.BeginSelectImages();
  for i := 0 to ImageEnMView1.ImageCount - 1 do
    if ImageEnMView1.Checked[i] then
      ImageEnMView1.SelectedImage := i;
  ImageEnMView1.EndSelectImages();

  ImageEnMView1.MIO.SaveToFile( 'C:\Images.tiff', ioUnknown, True );

finally
  ImageEnMView1.EnableMultiSelect := wasMS;
  ImageEnMView1.UnlockUpdate();
end;


See Also

SelectedFilename
SelectedFilenames
SelectedImageAlwaysVisible