private void _exportToImageButton_Click(Object sender, EventArgs e) { Canvas activeCanvas = _tabbedMdi.ActiveCanvas; if (activeCanvas != null) { Control schema = activeCanvas.Schema; using (Bitmap bmp = new Bitmap(schema.Width, schema.Height)) { NuGenControlPaint.DrawToBitmap(schema, bmp); Application.DoEvents(); using (NuGenSmoothImageExportBlock imageExport = new NuGenSmoothImageExportBlock()) { Application.DoEvents(); imageExport.ThumbnailMode = NuGenThumbnailMode.LoupeView; imageExport.Images.Add(bmp); StringCollection exportPathCollection = Settings.Default.MainForm_ExportPathCollection; if (exportPathCollection != null) { foreach (String path in exportPathCollection) { imageExport.ExportPathCollection.Add(path); } } imageExport.ShowDialog(this); Settings.Default.MainForm_ExportPathCollection = imageExport.ExportPathCollection; } } } }
private void _printButton_Click(object sender, EventArgs e) { Canvas activeCanvas = _tabbedMdi.ActiveCanvas; if (activeCanvas != null) { if (!ScanningAndPrinting.CanPrint) { ShowWiaError(); return; } Control schema = activeCanvas.Schema; using (Bitmap bmp = new Bitmap(schema.Width, schema.Height)) { NuGenControlPaint.DrawToBitmap(schema, bmp); String tempFileName = Path.GetTempFileName(); String tempBmpFileName = String.Format(CultureInfo.CurrentCulture, "{0}.bmp", tempFileName); bmp.Save(tempBmpFileName, ImageFormat.Bmp); ScanningAndPrinting.Print(this, tempBmpFileName); try { File.Delete(tempFileName); File.Delete(tempBmpFileName); } catch { } } } }
/// <summary> /// </summary> public Image GetSketch() { Rectangle bounds = this.GetBounds(); Bitmap sketch = new Bitmap(bounds.Width, bounds.Height); NuGenControlPaint.DrawToBitmap(_hWnd, sketch); return(sketch); }
private void _exportToImageButton_Click(Object sender, EventArgs e) { Canvas activeCanvas = _tabbedMdi.ActiveCanvas; if (activeCanvas != null) { Control schema = activeCanvas.Schema; using (Bitmap bmp = new Bitmap(schema.Width, schema.Height)) { NuGenControlPaint.DrawToBitmap(schema, bmp); NuGenSmoothImageExportBlock imageExport = new NuGenSmoothImageExportBlock(); imageExport.ThumbnailMode = NuGenThumbnailMode.LoupeView; imageExport.Images.Add(bmp); imageExport.ShowDialog(this); } } }