简体   繁体   English

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

[英]Handle not Allocated on setting form property on Android in Delphi XE7

I'm having problem opening a new form that i've created in XE7. 我在打开一个我在XE7中创建的新表单时遇到了问题。 I have no problems opening the form on my Samsung Galaxt tab2, but when I want to open it on my Sony Xperia ZR I get a Handle not Allocated exception. 我在三星Galaxt tab2上打开表单没有问题,但是当我想在我的Sony Xperia ZR上打开它时,我得到一个Handle not Allocated异常。

Here is the code: 这是代码:

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;

Code below shows the decleration of the property and the setter: 下面的代码显示了属性和setter的decleration:

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;

Code for the SetBitmap method: 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;

Anyone knows a solution? 谁知道解决方案?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM