From 114c2d502cb0cb094b2626f5056fef7ab9a2dfcb Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期五, 14 三月 2025 08:32:52 +0800
Subject: [PATCH] toErp
---
DevApp/Gs.DevApp/DevFrm/XtraForm1.cs | 175 ++++++++--------------------------------------------------
1 files changed, 24 insertions(+), 151 deletions(-)
diff --git a/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs b/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
index 3ca0776..6458e38 100644
--- a/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
+++ b/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
@@ -1,177 +1,50 @@
-锘縰sing DevExpress.XtraBars.Docking;
-using DevExpress.XtraEditors;
+锘縰sing DevExpress.XtraEditors;
+using DevExpress.XtraLayout;
+using DevExpress.XtraPrinting.Export;
+using DevExpress.XtraRichEdit.Model;
+using Gs.DevApp.ToolBox;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using System.Xml.Serialization;
+
namespace Gs.DevApp.DevFrm
{
public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
{
- private bool isDragging = false;
- private Point dragCursorPoint;
- private Point dragPanelPoint;
- private Control dragSourceContainer;
+
public XtraForm1()
{
InitializeComponent();
- // 鍒濆鍖栬〃鍗�
- this.Text = "Draggable Panel Example";
- this.Size = new Size(800, 600);
-
- // 娣诲姞榧犳爣浜嬩欢澶勭悊绋嬪簭
-
- // 閬嶅巻 parentPanel 涓殑鎵�鏈夊瓙鎺т欢
- foreach (Control control in panelControl1.Controls)
- {
- // 妫�鏌ュ綋鍓嶆帶浠舵槸鍚︽槸涓�涓� Panel
- if (control is PanelControl panel)
- {
- // 鍦ㄨ繖閲屽瀛� Panel 鎵ц鎿嶄綔
- // 渚嬪锛屾墦鍗板嚭瀛� Panel 鐨勫悕瀛楋紙濡傛灉鏈夎缃� Name 灞炴�э級
- Console.WriteLine(panel.Name ?? "鏃犲悕Panel");
-
- // 鎴栬�呬綘鍙互璋冪敤鍏朵粬鏂规硶锛屼紶閫掕繖涓� panel 浣滀负鍙傛暟
- // SomeMethod(panel);
-
- control.MouseDown += new MouseEventHandler(DraggablePanel_MouseDown);
- control.MouseMove += new MouseEventHandler(DraggablePanel_MouseMove);
- control.MouseUp += new MouseEventHandler(DraggablePanel_MouseUp);
-
- }
- }
-
-
+
}
- private void DraggablePanel_MouseDown(object sender, MouseEventArgs e)
+
+ private void button1_Click(object sender, EventArgs e)
{
- if (e.Button == MouseButtons.Left)
- {
- // 浠庝簨浠跺弬鏁� DragEventArgs 涓幏鍙栬鎷栧姩鐨勫厓绱�
- PanelControl _soucePanel = (PanelControl)sender;
- isDragging = true;
- dragCursorPoint = Cursor.Position;
- dragPanelPoint = _soucePanel.Location;
- _soucePanel.Cursor = Cursors.SizeAll;
- dragSourceContainer = _soucePanel.Parent;
- }
+ string ddddd = GetLayoutControlXml(layoutControl1);
+
}
- private void DraggablePanel_MouseMove(object sender, MouseEventArgs e)
+ public string GetLayoutControlXml(LayoutControl layoutControl)
{
- if (isDragging)
- {
- PanelControl _soucePanel = (PanelControl)sender;
- string _mmm = dragSourceContainer.Name.ToString();
- if (_mmm == "panelControl1")
- {
- _soucePanel.Location = new Point(
- dragPanelPoint.X + Cursor.Position.X - dragCursorPoint.X,
- dragPanelPoint.Y + Cursor.Position.Y - dragCursorPoint.Y);
- Point newLocation = _soucePanel.Location;
- Rectangle bounds = panelControl1.Bounds;
- if (IsOutsideBounds(_soucePanel, panelControl1))
- {
- lbMsg.Text = _soucePanel.Location.ToString() + "-" + bounds.ToString() + ":pp" + _mmm;
- panelControl1.Controls.Remove(_soucePanel);
- dockPanel1.Controls.Add(_soucePanel);
- RefreshControls();
- _soucePanel.Location = new Point(
- Math.Max(0, Math.Min(dockPanel1.Width - _soucePanel.Width, newLocation.X - dockPanel1.Location.X)),
- Math.Max(0, Math.Min(dockPanel1.Height - _soucePanel.Height, newLocation.Y - dockPanel1.Location.Y)));
- }
- else
- {
- lbMsg.Text = _soucePanel.Location.ToString() + "-" + bounds.ToString() + ":pp" + _mmm;
- }
- return;
- }
- if (_mmm == "dockPanel1_Container")
- {
- _soucePanel.Location = new Point(
- dragPanelPoint.X + Cursor.Position.X - dragCursorPoint.X,
- dragPanelPoint.Y + Cursor.Position.Y - dragCursorPoint.Y);
- Point newLocation = _soucePanel.Location;
- Rectangle bounds = dockPanel1.Bounds;
- if (IsOutsideBounds(_soucePanel, dockPanel1))
- {
- lbMsg.Text = _soucePanel.Location.ToString() + "-" + bounds.ToString() + ":pp" + _mmm;
- dockPanel1.Controls.Remove(_soucePanel);
- panelControl1.Controls.Add(_soucePanel);
- RefreshControls();
- _soucePanel.Location = new Point(
- Math.Max(0, Math.Min(panelControl1.Width - _soucePanel.Width, newLocation.X - panelControl1.Location.X)),
- Math.Max(0, Math.Min(panelControl1.Height - _soucePanel.Height, newLocation.Y - panelControl1.Location.Y)));
- }
- else
- {
- lbMsg.Text = _soucePanel.Location.ToString() + "-" + bounds.ToString() + ":pp" + _mmm;
- }
- return;
- }
- }
+ string dddd = "";
+ layoutControl.SaveLayoutToXml(dddd);
+ // layoutControl.SaveLayoutToStream(dddd);
+ layoutControl1.RestoreLayoutFromXml("layout.xml");
+ return dddd;
+
+ // gcMain.MainView.RestoreLayoutFromXml(fileName);
+ // splitContainerControl1.
}
-
- public static bool IsOutsideBounds(Control childControl, Control parentControl)
- {
- int _w = childControl.Width / 2;
- int _h = childControl.Height / 2;
- // 鑾峰彇鐖舵帶浠剁殑瀹㈡埛鍖虹煩褰紙鐩稿浜庣埗鎺т欢鑷繁锛�
- Rectangle parentClientRect = parentControl.ClientRectangle;
-
- // 鑾峰彇瀛愭帶浠剁浉瀵逛簬鐖舵帶浠剁殑浣嶇疆鍜屽昂瀵�
- Rectangle childRectRelativeToParent = childControl.Bounds;
-
- // 妫�鏌ュ瓙鎺т欢鐨勫乏杈圭晫鏄惁瓒呭嚭浜嗙埗鎺т欢鐨勫乏杈圭晫
- if (childRectRelativeToParent.Left < parentClientRect.Left - _w)
- return true;
-
- // 妫�鏌ュ瓙鎺т欢鐨勫彸杈圭晫鏄惁瓒呭嚭浜嗙埗鎺т欢鐨勫彸杈圭晫
- if (childRectRelativeToParent.Right > parentClientRect.Right + _w)
- return true;
-
- // 妫�鏌ュ瓙鎺т欢鐨勯《杈圭晫鏄惁瓒呭嚭浜嗙埗鎺т欢鐨勯《杈圭晫
- if (childRectRelativeToParent.Top < parentClientRect.Top - _h)
- return true;
-
- // 妫�鏌ュ瓙鎺т欢鐨勫簳杈圭晫鏄惁瓒呭嚭浜嗙埗鎺т欢鐨勫簳杈圭晫
- if (childRectRelativeToParent.Bottom > parentClientRect.Bottom + _h)
- return true;
-
- // 濡傛灉瀛愭帶浠剁殑鎵�鏈夎竟鐣岄兘鍦ㄧ埗鎺т欢鐨勮竟鐣屽唴锛屽垯杩斿洖false
- return false;
- }
-
- private void DraggablePanel_MouseUp(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- isDragging = false;
- dragSourceContainer = panTuo.Parent;
- }
- }
-
-
- /// <summary>
- /// 瀵规帶浠朵腑鐨勯」杩涜鎺掑垪
- /// </summary>
- private void RefreshControls()
- {
- int y = 0;
- foreach (PanelControl btn in dockPanel1_Container.Controls)
- {
- btn.Left = 0;
- btn.Top = y;
- y += btn.Height + 15;
- }
- }
-
}
+
}
\ No newline at end of file
--
Gitblit v1.9.3