在 Delphi XE7 中 Android 上的设置表单 属性 上未分配句柄

Handle not Allocated on setting form property on Android in Delphi XE7

我在打开我在 XE7 中创建的新表单时遇到问题。我在我的 Samsung Galaxt tab2 上打开表格没有问题,但是当我想在我的 Sony Xperia ZR 上打开它时,我得到一个 Handle not Allocated 异常。

代码如下:

procedure TfrmNocoreDKS.actOpenDocumentExecute(Sender: TObject);
var
  frmDKSDocument: TfrmDKSDocument;
begin
  frmDKSDocument := TfrmDKSDocument.Create(nil);
  frmDKSDocument.ScaleBy := fScaleBy; 
  frmDKSDocument.UseAantal := fUseAantal;
  frmDKSDocument.DocumentId := TButton(Sender).Tag;
  frmDKSDocument.LoadDocument;
  frmDKSDocument.SetDocumentStatus := SetDocumentStatus;
  frmDKSDocument.Allowresize := True;
  frmDKSDocument.Show;
  frmDKSDocument.FillSigns;
end;

下面的代码显示了 属性 和 setter 的减速:

TfrmDksDocument = class(TForm)
private
  fScaleBy:Single;
public
  property ScaleBy:Single read fScaleBy write SetScaleBy;

procedure TfrmDksDocument.SetScaleBy(const Value: Single);
begin
  fScaleBy := Value;
  sgnController.ScaleBy := fScaleBy; //sgnController is a Custom Image component
  sgnController.setbitmap; //Here I get the exception
  sgnCustomer.ScaleBy := fScaleBy; //sgnCustomeris a Custom Image component
  sgnCustomer.setbitmap;
end;

SetBitmap 方法的代码:

procedure TisImage64.SetBitmap;
begin
  {$IFDEF WIN32}
  if not fBitmapCreated then
  Begin
    self.Bitmap := TBitMap.Create;
    self.Bitmap.SetSize(integer(trunc(Self.Size.Width)), integer(trunc(Self.Size.Height)));
    fBitmapCreated := True;
    self.clear;
  End;
  {$ENDIF}
  {$IFDEF ANDROID}
    self.Bitmap := MultiResBitMap.Add.Bitmap; //.Add.Bitmap;
    self.Bitmap.SetSize(integer(trunc(Self.Size.Width*fScaleBy)), integer(trunc(Self.Size.Height*fScaleBy)));
    fBitmapCreated := True;
    self.Clear;
  {$ENDIF}
  {$IFDEF IOS}
    self.Bitmap := MultiResBitMap.Add.Bitmap; //.Add.Bitmap;
    self.Bitmap.SetSize(integer(trunc(Self.Size.Width*fScaleBy)), integer(trunc(Self.Size.Height*fScaleBy)));
    fBitmapCreated := True;
    self.Clear;
  {$ENDIF}
end;

有人知道解决方案吗?

2 个图像组件的大小设置不正确