12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using WWPipeLine.MapBasic.Conditions;
- using Sunny.UI;
- using WeifenLuo.WinFormsUI.Docking;
- using SuperMap.Mapping;
- using WWPipeLine.MapBasic;
- namespace WWPipeLine.MapTools.Conditions.ShuJuChuLi
- {
- public partial class OutPicture : ConditionPanel
- {
- private string fileName = string.Empty;
- public OutPicture()
- {
- this.ConditionPanelName = "地图导出图片";
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- }
- private void uiButton1_Click(object sender, EventArgs e)
- {
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- sfd.Title = "请选择要保存的文件路径";
- sfd.Filter = "所有文件|*.*";
- if (sfd.ShowDialog() == DialogResult.OK)
- {
- fileName = sfd.FileName;
- uiTextBox1.Text = fileName;
- }
- }
- public override object Do(DockPanel dockPanel = null)
- {
- this.IsShowResultWindow = false;
- if (string.IsNullOrEmpty(fileName))
- { UIMessageTip.ShowError("请选择要保存的文件路径"); return false; }
- //bool result = false;
- //if (uiRBjpg.Checked) { result = MapControl.Map.OutputMapToJPG(fileName); }
- //else if (uiRBbmp.Checked) { result = MapControl.Map.OutputMapToBMP(fileName); }
- //else if (uiRBpng.Checked) { result = MapControl.Map.OutputMapToPNG(fileName, false); }
- //else if (uiRBgif.Checked) { result = MapControl.Map.OutputMapToGIF(fileName, false); }
- //else { result = MapControl.Map.OutputMapToJPG(fileName); }
- //ComsStatic.ShowUIMessageTipOKorError(result, "地图导出图片");
- ImageType imgType = ImageType.JPG; ;
- if (uiRBjpg.Checked) { imgType = ImageType.JPG; }
- if (uiRBbmp.Checked) { imgType = ImageType.BMP; }
- if (uiRBpng.Checked) { imgType = ImageType.PNG; }
- if (uiRBgif.Checked) { imgType = ImageType.GIF; }
- if (uiRBtiff.Checked) { imgType = ImageType.TIFF; }
- bool result = MapControl.Map.OutputMapToFile(fileName, imgType, 96, MapControl.Map.ViewBounds, false);
- ComsStatic.ShowUIMessageTipOKorError(result, "地图导出图片");
- return true;
- }
- }
- }
|