From 3cad85b98fff4ef5f45a1dc488c6620aa2f082e2 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期二, 25 二月 2025 11:03:36 +0800
Subject: [PATCH] 销售通知单

---
 DevApp/Gs.DevApp/DevFrm/XtraForm1.cs |  164 +++---------------------------------------------------
 1 files changed, 9 insertions(+), 155 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs b/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
index 3ca0776..ddd3a07 100644
--- a/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
+++ b/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
@@ -1,5 +1,6 @@
-锘縰sing DevExpress.XtraBars.Docking;
-using DevExpress.XtraEditors;
+锘縰sing DevExpress.XtraEditors;
+using DevExpress.XtraRichEdit.Model;
+using Gs.DevApp.ToolBox;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -14,164 +15,17 @@
 {
     public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
     {
-        private bool isDragging = false;
-        private Point dragCursorPoint;
-        private Point dragPanelPoint;
-        private Control dragSourceContainer;
+        private Gs.DevApp.ToolBox.DragResizeHelp _drapHelp;
         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);
-
-                }
-            }
-
-
+           // this.xtraTabControl1.CustomHeaderButtonClick += new DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventHandler(this.xtraTabControl1_CustomHeaderButtonClick);
+            _drapHelp = new DragResizeHelp(this, splitContainerControl1.Panel1, labelControl2);
         }
-        private void DraggablePanel_MouseDown(object sender, MouseEventArgs e)
+
+        private void xtraTabControl1_CustomHeaderButtonClick(object sender, DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs 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;
-            }
+            _drapHelp.Show();
         }
-
-        private void DraggablePanel_MouseMove(object sender, MouseEventArgs e)
-        {
-            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;
-                }
-            }
-        }
-
-        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