From baef454ef7dc66bc1dfbe7abef57f497ae1e05a1 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 04 六月 2025 08:28:15 +0800
Subject: [PATCH] iqc巡检导出
---
DevApp/Gs.DevApp/UserControl/showLayOut.cs | 98 +++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 82 insertions(+), 16 deletions(-)
diff --git a/DevApp/Gs.DevApp/UserControl/showLayOut.cs b/DevApp/Gs.DevApp/UserControl/showLayOut.cs
index 898e65b..bd71af9 100644
--- a/DevApp/Gs.DevApp/UserControl/showLayOut.cs
+++ b/DevApp/Gs.DevApp/UserControl/showLayOut.cs
@@ -1,14 +1,12 @@
锘縰sing DevExpress.XtraEditors;
+using DevExpress.XtraGrid.Views.Grid;
+using DevExpress.XtraLayout;
using Gs.DevApp.ToolBox;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
+using System.IO;
using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace Gs.DevApp.UserControl
@@ -16,26 +14,99 @@
public partial class showLayOut : DevExpress.XtraEditors.XtraForm
{
string formNamespace = "";
- public showLayOut(string _formNamespace)
+ List<GridView> gridViews = new List<GridView>();
+ List<DevExpress.XtraLayout.LayoutControl> layList = new List<DevExpress.XtraLayout.LayoutControl>();
+ List<DevExpress.XtraEditors.SplitContainerControl> spcList = new List<DevExpress.XtraEditors.SplitContainerControl>();
+ public showLayOut(string _formNamespace, List<GridView> _gridViews, List<DevExpress.XtraLayout.LayoutControl> _layList, List<DevExpress.XtraEditors.SplitContainerControl> _spcList)
{
- formNamespace= _formNamespace;
+ formNamespace = _formNamespace;
+ gridViews = _gridViews;
+ layList = _layList;
+ spcList = _spcList;
InitializeComponent();
this.btnCancel.Click += BtnCancel_Click;
this.btnSave.Click += BtnSave_Click;
}
-
private void BtnSave_Click(object sender, EventArgs e)
+ {
+ _setLyout();
+ }
+
+ private void BtnCancel_Click(object sender, EventArgs e)
+ {
+ Close();
+ }
+
+ private void _setLyout()
{
if (txt_layOut.SelectedIndex <= 0)
{
MsgHelper.Warning("璇烽�夋嫨閫傜敤鑼冨洿锛�");
return;
}
+ List<dynamic> xmlList = new List<dynamic>();
+ foreach (GridView gridView1 in gridViews)
+ {
+ System.IO.Stream stream = new System.IO.MemoryStream();
+ gridView1.SaveLayoutToStream(stream);
+ stream.Seek(0, System.IO.SeekOrigin.Begin);
+ StringBuilder sb = new StringBuilder();
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ char[] buffer = new char[4096]; // 缂撳啿鍖哄ぇ灏忔牴鎹渶瑕佽皟鏁�
+ int numCharsRead;
+ while ((numCharsRead = reader.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ sb.Append(buffer, 0, numCharsRead);
+ }
+ }
+ xmlList.Add(
+ new { idType = "gridview", idName = gridView1.Name, idXml = sb.ToString(), splitterPosition = "" }
+ );
+ }
+ foreach (LayoutControl lay1 in layList)
+ {
+ System.IO.Stream stream = new System.IO.MemoryStream();
+ lay1.SaveLayoutToStream(stream);
+ stream.Seek(0, System.IO.SeekOrigin.Begin);
+ StringBuilder sb = new StringBuilder();
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ char[] buffer = new char[4096]; // 缂撳啿鍖哄ぇ灏忔牴鎹渶瑕佽皟鏁�
+ int numCharsRead;
+ while ((numCharsRead = reader.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ sb.Append(buffer, 0, numCharsRead);
+ }
+ }
+ xmlList.Add(
+ new { idType = "layoutcontrol ", idName = lay1.Name, idXml = sb.ToString(), splitterPosition = "" }
+ );
+ }
+ foreach (SplitContainerControl splt in spcList)
+ {
+ System.IO.Stream stream = new System.IO.MemoryStream();
+ splt.SaveLayoutToStream(stream);
+ stream.Seek(0, System.IO.SeekOrigin.Begin);
+ StringBuilder sb = new StringBuilder();
+ using (StreamReader reader = new StreamReader(stream))
+ {
+ char[] buffer = new char[4096]; // 缂撳啿鍖哄ぇ灏忔牴鎹渶瑕佽皟鏁�
+ int numCharsRead;
+ while ((numCharsRead = reader.Read(buffer, 0, buffer.Length)) > 0)
+ {
+ sb.Append(buffer, 0, numCharsRead);
+ }
+ }
+ xmlList.Add(
+ new { idType = "splitcontainercontrol ", idName = splt.Name, idXml = sb.ToString(), splitterPosition = splt.SplitterPosition }
+ );
+ }
var _obj = new
{
- applyUserGuid = txt_layOut.SelectedIndex,
- layoutLst= "col1,100,101,102,103,104,105,1,title&gridview1=col2,100,101,102,103,104,105,1,title",
- formPath = formNamespace
+ xmlList = xmlList,
+ formPath = formNamespace,
+ intType = txt_layOut.SelectedIndex,
};
try
{
@@ -58,11 +129,6 @@
DialogResult = DialogResult.Cancel;
MsgHelper.Warning("鎻愮ず锛�" + ex.Message);
}
- }
-
- private void BtnCancel_Click(object sender, EventArgs e)
- {
- Close();
}
}
}
\ No newline at end of file
--
Gitblit v1.9.3