Changeset 10006
- Timestamp:
- 09/25/13 13:55:12 (11 years ago)
- Location:
- stable
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 9946,10002
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Visualization.ChartControlsExtensions/3.3/ImageExportDialog.cs
r9532 r10006 68 68 Width = 305; 69 69 Height = 625; 70 } finally { SuppressEvents = false; } 70 } 71 finally { SuppressEvents = false; } 71 72 #endregion 72 73 } … … 93 94 if (workingChart.Legends.Count == 0) legendFontSizeComboBox.Text = "6"; 94 95 else legendFontSizeComboBox.Text = workingChart.Legends[0].Font.SizeInPoints.ToString(); 95 } finally { 96 } 97 finally { 96 98 SuppressEvents = false; 97 99 } … … 209 211 } 210 212 } 211 } finally { SuppressEvents = false; } 213 } 214 finally { SuppressEvents = false; } 212 215 base.OnShown(e); 213 216 … … 438 441 float height; 439 442 GetImageParameters(out dpi, out width, out height); 440 441 443 var image = new Bitmap((int)Math.Round(width), (int)Math.Round(height)); 442 444 image.SetResolution(dpi, dpi); 443 using (var graphics = Graphics.FromImage(image)) {444 workingChart.Printing.PrintPaint(graphics, new Rectangle(0, 0, image.Width, image.Height));445 }446 447 445 if (titleTextBox.Text.Trim() != String.Empty) saveFileDialog.FileName = titleTextBox.Text.Trim(); 448 446 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 449 447 var format = ImageFormat.Bmp; 450 448 var filename = saveFileDialog.FileName.ToLower(); 451 if (filename.EndsWith("jpg")) { 452 format = ImageFormat.Jpeg; 453 } else if (filename.EndsWith("emf")) { 454 format = ImageFormat.Emf; 455 } else if (filename.EndsWith("gif")) { 456 format = ImageFormat.Gif; 457 } else if (filename.EndsWith("png")) { 458 format = ImageFormat.Png; 459 } else if (filename.EndsWith("tif")) { 460 format = ImageFormat.Tiff; 461 } 462 image.Save(saveFileDialog.FileName, format); 463 } 464 449 if (filename.EndsWith("emf")) { 450 using (var graphics = Graphics.FromImage(image)) { 451 var rectangle = new Rectangle(0, 0, image.Width, image.Height); 452 using (var metafile = new Metafile(filename, graphics.GetHdc(), rectangle, MetafileFrameUnit.Pixel, EmfType.EmfPlusDual)) { 453 graphics.ReleaseHdc(); 454 using (var g = Graphics.FromImage(metafile)) { 455 workingChart.Printing.PrintPaint(g, rectangle); 456 } 457 } 458 } 459 } else { 460 using (var graphics = Graphics.FromImage(image)) { 461 workingChart.Printing.PrintPaint(graphics, new Rectangle(0, 0, image.Width, image.Height)); 462 } 463 if (filename.EndsWith("jpg")) { 464 format = ImageFormat.Jpeg; 465 } else if (filename.EndsWith("gif")) { 466 format = ImageFormat.Gif; 467 } else if (filename.EndsWith("png")) { 468 format = ImageFormat.Png; 469 } else if (filename.EndsWith("tif")) { 470 format = ImageFormat.Tiff; 471 } 472 image.Save(saveFileDialog.FileName, format); 473 } 474 } 465 475 image.Dispose(); 466 467 476 Cleanup(); 468 477 }
Note: See TracChangeset
for help on using the changeset viewer.