TCanvasAttribute.MaxBitmapSize value in OnActivate event

  

I know this is a very specific case, so I would like to explain what the real problem is.

I have a FMX form that is sometimes used as a separate window and sometimes embedded in another form. When the form is activated, it will check if anything has changed and if so, it will reload some images. However I found out that if the form has BorderStyle = None, than at first activation TCanvasAttribute.MaxBitmapSize returns value 1024, but every other is 8192. Which is a problem for setting the dimensions from bitmap using img1.Bitmap.LoadFromStream.

When I tried to find out where this value came from, I got a constant MaxAllowedBitmapSize, so I don’t even understand how it could be possibly changed. I’m not sure if this is a bug or some special behaviour, so I would appreciate any help.

Here is a simple test application that should work at least on XE6.

object Form1: TForm1
Left = 0
Top = 0
BorderStyle = None
Caption = ‘Form1’
ClientHeight = 480
ClientWidth = 640
FormFactor.Width = 320
FormFactor.Height = 480
FormFactor.Devices = [Desktop, iPhone, iPad]
OnActivate = FormActivate
DesignerMobile = False
DesignerWidth = 0
DesignerHeight = 0
DesignerDeviceName = ”
DesignerOrientation = 0
DesignerOSVersion = ”
object img1: TImage
MultiResBitmap = <
item
end>
Align = Client
Height = 480.000000000000000000
Width = 640.000000000000000000
end
end

and form’s OnActivate event

procedure TForm1.FormActivate(Sender: TObject);
var
lSize : Integer;
begin
lSize := img1.Bitmap.CanvasClass.GetAttribute(TCanvasAttribute.MaxBitmapSize);
end

Comments are closed.