Loading directly from stream

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
uschr67
Posts: 1
Joined: 08 Jan 2007, 19:36
Location: Germany

Loading directly from stream

Post by uschr67 » 08 Jan 2007, 19:51

Hi,
a short question regarding TsgImage.
Is directly loading with a filestream (downloaded plt-file)
for TsgImage possible ?

Thank's in advance
US

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 12 Jan 2007, 17:59

Hello,

Please try the following example:

Code: Select all

<b>uses</b>
  ... HPGL2, SGImage;

<b>type</b>
  TForm1 = <b>class</b>(TForm)
    ...
    btnOpen: TButton;
    sgImage1: TsgImage;
    <b>procedure</b> btnOpenClick(Sender: TObject);
  <b>private</b>
    ...

...
<b>procedure</b> TForm1.btnOpenClick(Sender: TObject);
<b>var</b>
  vFileStream: TFileStream;
  vImage: TsgHPGLImage;
<b>begin</b>
  vFileStream := TFileStream.Create(<font color="blue">'c:\Test.plt'</font id="blue">, fmOpenRead);
  vImage := TsgHPGLImage.Create;
  vImage.LoadFromStream(vFileStream);
  vFileStream.Free;
  sgImage1.Picture.Graphic := vImage;
  vImage.Free;
<b>end</b>;

<b>end</b>.
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

Post Reply