ImageEn, unit imageenview

TImageEnView.SelectedRect

TImageEnView.SelectedRect


Declaration

property SelectedRect: TIERectangle;


Description

Returns current selected rectangle. If no selected exists returns the whole image rectangle.
The coordinates are returned in terms of the bitmap (not the screen, i.e. not affected by Zoom and ViewX, ViewY values).
You can programmatically make a selection using the Select method.

If you specify a SelectedRect it will replace any existing selection (you must pass a complete TIERectangle variable).

Read-only


Example

// Zoom into the selected area of the image
procedure TMainForm.Button1Click(Sender: TObject);
var
  sel: TIERectangle;
begin
  if ImageEnView1.Selected then
  begin
    sel := ImageEnView1.SelectedRect;
    ImageEnView1.VisibleBitmapRect := Rect( sel.x, sel.y, sel.x + sel.width, sel.y + sel.height );
  end;
end;

// Crop the image at the bitmap position, Top-Left: (150, 100), Bottom-right: (450, 300)
ImageEnView1.SelectedRect := IERectangle( Rect( 100, 100, 300, 200 ));
ImageEnView1.Proc.CropSel();

// Which is the same as...
ImageEnView1.SelectionBase := iesbBitmap;
ImageEnView1.Select( 150, 100, 300, 200 );
ImageEnView1.Proc.CropSel();