« The Onion on "The War on Terrier" : men buy too many mobiles phones, charged with terror offenses | Main | Planet Rupert »

August 15, 2006

MDL Draw control tips in Delphi

... although it should work generally. Note I'm using Viatcheslav V. Vassiliev's Managed VCL components for Delphi 7 ...

Assume you have configured a TClrControl and set the AssemblyName property to MDL.Draw.Renderer, Version=1.4.1000.20, Culture=neutral, PublicKeyToken=e922e3fd683b3777 (although the MDL.Draw.Renditor assembly will also do), and the ControlName property to MDL.Draw.Renderer.Renderer (although the MDL.Draw.Renditor.Editor control will also do).

Assume that you've read a molfile into variable MolFileString. You can set the molfile property of the Renderer control using the following code:

  ClrControl1.ClrObject.DispProperty['MolFileString']:=
   MolFileString

Assume you also have a TImage instance available that you want to capture the Renderer image into as a bitmap. You can easily do it like this:

  ClrControl1.ClrObject.DispProperty['MolFileString']:=
   ClientDataSet1.FieldByName('ConvMolfileString').AsString;
  Image1.Picture.Bitmap.Handle:=
   ClrControl1.ClrObject.DispProperty['Image'].GetHBitmap;

Posted by daen at August 15, 2006 02:39 PM

Comments

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?