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.
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.
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.
ReplyDeleteWouter van Nifterick Can't find constraint in FMX.
ReplyDeleteDid 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.
ReplyDeleteMagno Lima ah, FMX... well, i guess no constraints property for you then. :)
ReplyDeleteEli M The scale if fixed, it won't change. I really not get the "true" size of an image when it gets stretched.
ReplyDeleteTImageWrapMode.Fit:
ReplyDeletebegin
LR := TRectF.Create(0, 0, Width, Height);
R := Link.SourceRect.Rect;
R := R.FitInto(LR).Round;
Canvas.DrawBitmap(B, SR, R, AOpacity, HighSpeed);
end;
Eli M Gonna try it! Thanks
ReplyDelete