I have a rectangle, inside of that a TImage with wrap mode set to Fit. Bellow the rectangle I have a splitter. Now I need to avoid the image get shrink to less the rectangle width.

I have a rectangle, inside of that a TImage with wrap mode set to Fit. Bellow the rectangle I have a splitter. Now I need to avoid the image get shrink to less the rectangle width.
When the splitter is moved above it will shrink the rect size, the image gets smaller and proportional, thats good, but I need to stop before visual size of the image gets smaller than the rect width.
Problem is that I cannot get the "real" image size comparing to the rectangle.

Comments

  1. It’s not fully clear how your setup is, but I guess that setting the “constraint” properties could help you out. With that you can set the minimum and maximum width/height that controls can shrink/expand to.

    ReplyDelete
  2. Wouter van Nifterick Can't find constraint in FMX.

    ReplyDelete
  3. Did you try TImage.Bitmap.Width? Might have to multiply by Scale as well. Or are you looking for the proportional size? Could drill down into the TImage source and see how it calculates it.

    ReplyDelete
  4. Magno Lima ah, FMX... well, i guess no constraints property for you then. :)

    ReplyDelete
  5. Eli M The scale if fixed, it won't change. I really not get the "true" size of an image when it gets stretched.

    ReplyDelete
  6. TImageWrapMode.Fit:
    begin
    LR := TRectF.Create(0, 0, Width, Height);
    R := Link.SourceRect.Rect;
    R := R.FitInto(LR).Round;
    Canvas.DrawBitmap(B, SR, R, AOpacity, HighSpeed);
    end;

    ReplyDelete

Post a Comment