public void DrawImageContent(int windowId) { //Always draw close button first DrawCloseButton(() => _selectedImage = 0, _imageWindowRect); if (GUI.RepeatButton(new Rect(_imageWindowRect.width - 15, _imageWindowRect.height - 15, 10, 10), ResizeIcon, ResizeButtonStyle)) { ResizingWindow = true; } GUILayout.BeginVertical(); GUI.DragWindow(MoveRect); GUILayout.BeginHorizontal(); if (GUILayout.Button(SaveIcon, ButtonStyle)) { System.SaveImage(_selectedFolder, _selectedImage); //Close after saving _selectedImage = 0; } GUILayout.EndHorizontal(); GUILayout.Space(15); if (_selectedImage == 0) { return; } GUILayout.BeginVertical(BoxStyle); _imageScrollPos = GUILayout.BeginScrollView(_imageScrollPos, ScrollStyle); if (System.DownloadedImages.TryGetValue(_selectedFolder, out var imagesDictionary) && imagesDictionary.TryGetValue(_selectedImage, out var screenShot)) { DrawImageCentered(screenShot); } else { DrawWaitIcon(false); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndVertical(); }
public static bool SaveChart(System.Windows.Forms.DataVisualization.Charting.Chart chart1) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "*Картинка формата png (*.png)|*.png"; if(sfd.ShowDialog()==DialogResult.OK) { try { chart1.SaveImage(sfd.FileName, ChartImageFormat.Png); return true; } catch { return false; } } return false; }
public void DrawImageContent(int windowId) { //Always draw close button first DrawCloseButton(() => _selectedImage = 0, _imageWindowRect); if (GUI.RepeatButton(new Rect(_imageWindowRect.width - 15, _imageWindowRect.height - 15, 10, 10), ResizeIcon, ResizeButtonStyle)) { ResizingWindow = true; } GUILayout.BeginVertical(); GUI.DragWindow(MoveRect); GUILayout.BeginHorizontal(); if (GUILayout.Button(SaveIcon)) { System.SaveImage(_selectedFolder, _selectedImage); //Close after saving _selectedImage = 0; } GUILayout.EndHorizontal(); GUILayout.Space(15); if (_selectedImage == 0) { return; } GUILayout.BeginVertical(); _imageScrollPos = GUILayout.BeginScrollView(_imageScrollPos); if (System.DownloadedImages.TryGetValue(_selectedFolder, out var imagesDictionary) && imagesDictionary.TryGetValue(_selectedImage, out var screenShot)) { DrawImageCentered(screenShot); } else { DrawWaitIcon(false); System.MessageSender.RequestImage(_selectedFolder, _selectedImage); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndVertical(); if (Miniatures.Count > 1) { //Draw screenshot cycle buttons if we have more than 1 screenshot GUILayout.Space(15); GUILayout.BeginHorizontal(); if (GUILayout.Button(CycleFirstIcon)) { //Load first image. _selectedImage = Miniatures[0].DateTaken; } if (GUILayout.Button(CyclePreviousIcon)) { //Load previous image. If start of index, load last image. _selectedImage = Miniatures[CurrentIndex > 0 ? CurrentIndex - 1 : Miniatures.Count - 1].DateTaken; } if (GUILayout.Button(CycleNextIcon)) { //Load next image. If end of index, load first image. _selectedImage = Miniatures[CurrentIndex < Miniatures.Count - 1 ? CurrentIndex + 1 : 0].DateTaken; } if (GUILayout.Button(CycleLastIcon)) { //Load last image. _selectedImage = Miniatures[Miniatures.Count - 1].DateTaken; } GUILayout.EndHorizontal(); } GUILayout.Space(15); }
private void AddImageToHTML(HtmlTextWriter writer, string base_name, string aero_element, System.Web.UI.DataVisualization.Charting.Chart chart) { chart.Page = this; chart.SaveImage(AeroReader.DefPath + base_name); //chart.RenderControl(writer); writer.Write("<img style='display:inline-block;width:{0}px;height:{1}px;border-width:0px' src='{2}' alt='{3}'/>\n", ChartWidth ,ChartHeight, base_name, aero.Description(aero_element)); // writer.Write("<img style='display:inline-block;height:7cm;width:5cm;border-width:0px' src='{0}' alt='{1}'/>\n", base_name, aero.Description(aero_element)); }