Jump to content
Sign in to follow this  
sw4all

TImageViewer resize parent component

Recommended Posts

Hi,
I have a TImageViewer component on my form.
At runtime, I create the TRectangle component and place it in ImageViewer.
Now I need the Rectangle component to be automatically resized (Height and Width)
by ImageViewer.BitmapScale and also to move in the correct position X and Y.

Please help.

Thank you

 

StartPositionX := 1032; // rectangle1.Position.X
StartPositionY := 304; // rectangle1.Position.Y

procedure TfrmMain.ImageViewer1CalcContentBounds(Sender: TObject;
  var ContentBounds: TRectF);
begin
  rectangle1.Scale.X := imgNahled.BitmapScale;
  rectangle1.Scale.Y := imgNahled.BitmapScale;

  rectangle1.Position.X := StartPositionX * imgNahled.BitmapScale;
  rectangle1.Position.Y := StartPositionY * imgNahled.BitmapScale;
end;

 

Edited by sw4all

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×