Hi, after the new update to 5.2.0 I have a problem with TImageEnVect and the method CopyObjectsToBack.
It worked before when I created images on the fly in a web service, therefore I won't have a parent window...
Please see the testcode below:
procedure TForm1.btn4Click(Sender: TObject);
var
i: byte;
Imv: TImageEnVect;
TextObject: Integer;
tmpFont: TFont;
DataLabel, DataValue: String;
begin
Imv := TImageEnVect.Create(nil);
TRY
tmpFont := TFont.Create;
tmpFont.Color := HexToTColor(MapTextColor);
tmpFont.Size:= 15;
tmpFont.Name:= 'Calibri';
tmpFont.Style := [fsBold];
Imv.IO.LoadFromURL(MapTemplate);
TextObject := Imv.AddNewObject(iekMEMO, Rect(25, 25, 800, 100), HexToTColor(MapTextColor));
Imv.ObjFontLocked[TextObject] := true;
Imv.ObjText[TextObject] := AnsiString('Title');
Imv.SetObjFont(TextObject, tmpFont);
Imv.ObjMemoBorderStyle[TextObject] := psClear;
Imv.ObjMemoCharsBrushStyle[TextObject] := bsClear;
Imv.ObjBrushStyle[TextObject] := bsClear;
tmpFont.Size:= 13;
DataLabel := uppercase('NSW');
DataValue := '1%';
TextObject := Imv.AddNewObject(iekMEMO, Rect(760, 395, 820, 425), HexToTColor(MapTextColor));
Imv.ObjText[TextObject] := AnsiString(DataValue);
Imv.SetObjFont(TextObject, tmpFont);
Imv.ObjMemoBorderStyle[TextObject] := psClear;
Imv.ObjMemoCharsBrushStyle[TextObject] := bsClear;
Imv.ObjBrushStyle[TextObject] := bsClear;
Imv.ObjTextAlign[TextObject] := iejCenter;
Imv.CopyObjectToBack(TextObject, True, true); // Here it crashes
Imv.RemoveAllObjects;
Imv.IO.SaveToFilePNG('c:\temp\test.png');
FINALLY
tmpFont.Free;
Imv.free;
END;
end;
It works when I assign a parent window to Imv after I create it!
Imv.ParentWindow := Form1.Handle;
But this is no option for me because it has to run in a web service without parent vcl windows. It worked in the previous version, so something must have changed or is there a work around?