static Result ExportToImage3( Document doc )
{
Result r = Result.Failed;
using( Transaction tx = new Transaction( doc ) )
{
tx.Start( "Export Image" );
string desktop_path = Environment.GetFolderPath(
Environment.SpecialFolder.Desktop );
View view = doc.ActiveView;
string filepath = Path.Combine( desktop_path,
view.Name );
ImageExportOptions img = new ImageExportOptions();
img.ZoomType = ZoomFitType.FitToPage;
img.PixelSize = 32;
img.ImageResolution = ImageResolution.DPI_600;
img.FitDirection = FitDirectionType.Horizontal;
img.ExportRange = ExportRange.CurrentView;
img.HLRandWFViewsFileType = ImageFileType.PNG;
img.FilePath = filepath;
img.ShadowViewsFileType = ImageFileType.PNG;
doc.ExportImage( img );
tx.RollBack();
filepath = Path.ChangeExtension(
filepath, "png" );
Process.Start( filepath );
r = Result.Succeeded;
}
return r;
}