...
using CADImport;
using CADImport.DWG;
using CADImport.DXF;
using CADImport.RasterImage;
...
private void CAD_to_BMP_Click(object sender, EventArgs e)
{
if ((OpenFileDialog1.ShowDialog() != DialogResult.OK)) return;
//CADImage.CreateImageByExtension detects format by the extension specified in the argument.
//The correct class for any supported format will be used automatically. We recommend to
//create a new drawing object with CADImage.CreateImageByExtension if import from the existed
//file/stream is required.
CADImage vDrawing = CADImage.CreateImageByExtension(OpenFileDialog1.FileName);
vDrawing.LoadFromFile(OpenFileDialog1.FileName);
// The bitmap will have 1000 px width, height will be calulated automatically
Bitmap vBitmap = new Bitmap(1000, (int)(1000 * vDrawing.AbsHeight / vDrawing.AbsWidth));
Graphics vGr = Graphics.FromImage(vBitmap);
RectangleF vRect = new RectangleF(0, 0, (float)1000, (float)(vBitmap.Width * vDrawing.AbsHeight / vDrawing.AbsWidth));
vDrawing.Draw(vGr, vRect);
vBitmap.Save(OpenFileDialog1.FileName + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
}