Prod.: Engine, ver.: 6, ID: 60000079, HowTo : Export Drawing to BMP

HowTo : Export Drawing to BMP

Article60000079
TypeHowTo
ProductEngine
Version6
Date Added3/15/2007
Submitted byRaymond Toh
Keywords

Subject

Export Drawing to BMP

Summary

I cannot find any samples which can show me how to export a drawing to BMP. I found a method rendertographics but do not know how to use it. In previous version ( version 5.0 ), I did it successfully, but the method used seems totally changed.

Solution

In a new project add a vdFramedControl, a picturebox  (this is optional) and a button and a code like :

VdFramedControl1.BaseControl.ActiveDocument.Open("C:\temp\EXAMPLE.dxf")
VdFramedControl1.BaseControl.ActiveDocument.CommandAction.CmdSelect(
"ALL")
Dim selset As VectorDraw.Professional.vdCollections.vdSelection
selset = VdFramedControl1.BaseControl.ActiveDocument.Selections.FindName(
"VDRAW_PREVIOUS_SELSET")
Dim a As VectorDraw.Geometry.Box|
a = selset.GetBoundingBox
PictureBox1.Width = 200 ' exported image will be 200x200 pixels
PictureBox1.Height = 200
Dim img1 As Image
img1 =
New Bitmap(PictureBox1.Width, PictureBox1.Height)
Dim graph As System.Drawing.Graphics
graph = Graphics.FromImage(img1)
VdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.RenderToGraphics(graph, a, img1.Width, img1.Height)
img1.Save(
"C:\_temp\aaaaa.bmp") 'save to disk
PictureBox1.Image = img1 ' show in form's Picture box