123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- using SuperMap.Mapping;
- using SuperMap.UI;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Windows.Forms;
- using WeifenLuo.WinFormsUI.Docking;
- namespace WWPipeLine.MapBasic.Results
- {
- public partial class ResultWindow : ToolWindowExtend
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public ResultWindow()
- {
- InitializeComponent();
-
- this.CloseButtonVisible = true;
- this.CloseButton = true;
- this.DockAreas = DockAreas.DockLeft
- | DockAreas.DockRight
- | DockAreas.DockTop
- | DockAreas.DockBottom
- | DockAreas.Document
- | DockAreas.Float;
- }
-
-
-
-
- public void ExportToExcel(System.Windows.Forms.DataGridView dg)
- {
- if (dg == null) return;
- var errMsg = Commons.ExportDgvToExcel.ExportExcel(dg);
- if (string.IsNullOrEmpty(errMsg))
- {
- ComsStatic.ShowOKLog("导出Excel文件成功");
- }
- else
- {
- if (errMsg == Commons.ExportDgvToExcel.CANCELRESULTSTRING)
- return;
- else
- ComsStatic.ShowErrorLog("导出Excel文件失败,原因是" + errMsg);
- }
- }
-
-
-
-
- public void ExportToImage(Control ctrl)
- {
- SaveFileDialog sfd = new SaveFileDialog
- {
- DefaultExt = "jpg",
- Filter = "图片文件(*.jpg)|*.jpg",
- RestoreDirectory = true,
- Title = "图片文件保存路径"
- };
- if (sfd.ShowDialog() == DialogResult.OK)
- {
- Bitmap bmp = new Bitmap(ctrl.Width, ctrl.Height);
- ctrl.DrawToBitmap(bmp, ctrl.ClientRectangle);
- bmp.Save(sfd.FileName);
- }
- }
-
-
-
-
- public virtual void ShowData(object data)
- {
- throw new Exception("未实现WWPipeLine.MapTools.Results.ResultWindow.ShowData");
- }
-
-
-
- protected Sunny.UI.UISymbolButton uiSymbolButtonExportToExcel;
-
-
-
- protected Sunny.UI.UISymbolButton uiSymbolButtonExportToImage;
-
-
-
- protected void CreateExportExcelButton()
- {
- this.uiSymbolButtonExportToExcel = new Sunny.UI.UISymbolButton
- {
- Cursor = System.Windows.Forms.Cursors.Hand,
- Dock = System.Windows.Forms.DockStyle.Bottom,
- Font = new System.Drawing.Font("微软雅黑", 12F),
- Location = new System.Drawing.Point(0, 415),
- MinimumSize = new System.Drawing.Size(1, 1),
- Name = "uiSymbolButtonExportToExcel",
- Size = new System.Drawing.Size(800, 20),
- Symbol = 61582,
- TabIndex = 0,
- Style = Sunny.UI.UIStyle.Gray,
- Text = "导出到Excel"
- };
- this.Controls.Add(this.uiSymbolButtonExportToExcel);
- }
-
-
-
- protected void CreateExportImageAndExcelButton()
- {
- Sunny.UI.UIPanel panel = new Sunny.UI.UIPanel
- {
- Dock = System.Windows.Forms.DockStyle.Bottom,
- Height = 20
- };
- this.Controls.Add(panel);
- this.uiSymbolButtonExportToExcel = new Sunny.UI.UISymbolButton
- {
- Dock = System.Windows.Forms.DockStyle.Fill,
- Cursor = System.Windows.Forms.Cursors.Hand,
- Font = new System.Drawing.Font("微软雅黑", 12F),
- Location = new System.Drawing.Point(0, 415),
- MinimumSize = new System.Drawing.Size(1, 1),
- Name = "uiSymbolButtonExportToExcel",
- Size = new System.Drawing.Size(800, 20),
- Symbol = 61582,
- TabIndex = 0,
- Style = Sunny.UI.UIStyle.Gray,
- Text = "导出到Excel",
- RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None,
- RadiusSides = Sunny.UI.UICornerRadiusSides.None
- };
- panel.Controls.Add(this.uiSymbolButtonExportToExcel);
- this.uiSymbolButtonExportToImage = new Sunny.UI.UISymbolButton
- {
- Dock = System.Windows.Forms.DockStyle.Left,
- Cursor = System.Windows.Forms.Cursors.Hand,
- Font = new System.Drawing.Font("微软雅黑", 12F),
- Location = new System.Drawing.Point(0, 415),
- MinimumSize = new System.Drawing.Size(1, 1),
- Name = "uiSymbolButtonExportToImage",
- Size = new System.Drawing.Size(800, 20),
- Symbol = 61893,
- TabIndex = 1,
- Style = Sunny.UI.UIStyle.Gray,
- Text = "导出图片",
- RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None,
- RadiusSides = Sunny.UI.UICornerRadiusSides.None
- };
- panel.Controls.Add(this.uiSymbolButtonExportToImage);
- this.SizeChanged += ResultWindow_SizeChanged;
- }
-
-
-
-
-
- private void ResultWindow_SizeChanged(object sender, EventArgs e)
- {
- uiSymbolButtonExportToExcel.Width = this.Width / 2;
- uiSymbolButtonExportToImage.Width = this.Width / 2;
- }
- }
- }
|