Display image with real dimension

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

Moderators: SDS, support, admin

Post Reply
lingli
Posts: 2
Joined: 09 Oct 2006, 12:39
Location: France

Display image with real dimension

Post by lingli » 09 Oct 2006, 12:58

I am evaluating the CADImport functions prior to purchase.
I want to open the file with format DWG, then view on the screen of Delphi in a component TImage or TsgImage, <font color="red">but with the dimension of image, as in the example View, click on the button btnIsWithoutBorder</font id="red">, then I want to save this image in a file bitmap *.bmp.

Can someone tell me what I need to do?

Thanks and best regards
Lingli


Lingli

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

Post by support » 10 Oct 2006, 10:01

Dear Lingli,

Please use the following construction:

Code: Select all

<b>uses</b>
  ... SGImage, DWG, SGExport;

<b>type</b>
  TForm1 = <b>class</b>(TForm)
...
  <b>private</b>
    Img: TsgDWGImage;
...

<b>implementation</b>

<font color="green">{$R *.dfm}</font id="green">

<b>procedure</b> TForm1.btnForum_328Click(Sender: TObject);
<b>var</b>
  E: TsgExport;
<b>begin</b>
  sgImage1.LoadFromFile(<font color="blue">'c:\test.dwg'</font id="blue">);
  <b>if</b> sgImage1.Picture.Graphic <b>is</b> TsgDWGImage <b>then
  begin</b>
    sgImage1.Align := alClient;
    Img := TsgDWGImage(sgImage1.Picture.Graphic);
  <b>end
  else
  begin</b>
    Img := <b>nil</b>;
    Exit;
  <b>end</b>;

  sgImage1.ChangeScale(True, 1, sgImage1.Center);
  Img.IsWithoutBorder := True;
  E := TsgExport.Create;
  <b>try</b>
    E.ExportTo(sgImage1.Picture.Graphic,
               <font color="blue">'c:\test.bmp'</font id="blue">,
               xpBitmap,
               sgImage1.Width,
               sgImage1.Height);
  <b>finally</b>
    E.Free;
  <b>end</b>;
<b>end</b>;
Sergey.


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

lingli
Posts: 2
Joined: 09 Oct 2006, 12:39
Location: France

Post by lingli » 10 Oct 2006, 11:34

Thanks Serge,
I do this, it works.
Lingli

Lingli

Post Reply