Hi,
Thanks very much for the project.
I have tested, and it worked on mine PC, too.
However, when I modified it to the same way I have in my project (moved it to a unit and created a class), the same thing happened.
Main unit:
unit main;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls,Unit1;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
public
{ Public declarations }
end;
var
Form1: TForm1;
Image32Panel1: testclass;
Image32Panel2: testclass;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Image32Panel1:=testclass.Create(Self,0);
Image32Panel2:=testclass.Create(Self,ClientWidth div 2);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
Image32Panel1.Free;
Image32Panel2.Free;
end;
end.
Class unit
unit Unit1;
interface
uses System.Classes,Img32.Panels,Img32, Img32.Vector, Img32.Draw, Img32.Text,VCL.Controls;
type testclass=class
private
FImagePanel:TImage32Panel;
fc: TFontCache;
public
constructor Create(AOwner:TComponent;LeftPos:integer);
destructor Destroy;
end;
implementation
{ testclass }
constructor testclass.Create(AOwner:TComponent;LeftPos:integer);
begin
fc := TFontCache.Create(FontManager.Load('Arial'), dpiAware(20));
FImagePanel:=TImage32Panel.Create(AOwner);
FImagePanel.Parent:=AOwner As TWinControl;
with FImagePanel do
begin
Left:=LeftPos;
Width := FImagePanel.Parent.ClientWidth div 2;
image.SetSize(InnerClientRect.Width,InnerClientRect.Height);
DrawLine(image, Rectangle(0,0,image.Width, image.Height), 10,
clRed32, esPolygon);
Img32.Text.DrawText(Image, Image.Bounds,
'This is TImagePanel Panel1', taCenter, tvaMiddle, fc);
end;
end;
destructor testclass.Destroy;
begin
FImagePanel.Free;
fc.Free;
end;
end.
img32_test.zip