From 3d429071ceeda5ce75ca660c13459c13f3d92337 Mon Sep 17 00:00:00 2001
From: lu <99954486@qq.com>
Date: 星期三, 26 二月 2025 10:30:11 +0800
Subject: [PATCH] 调拨

---
 DevApp/Gs.DevApp/DevFrm/XtraForm1.cs |   89 ++++++--------------------------------------
 1 files changed, 12 insertions(+), 77 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs b/DevApp/Gs.DevApp/DevFrm/XtraForm1.cs
index 5157073..a43388d 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,87 +15,21 @@
 {
     public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
     {
-
-        private bool isDragging = false;
-        private Point dragCursorPoint;
-        private Point dragPanelPoint;
-
+        private Gs.DevApp.ToolBox.DragResizeHelp _drapHelp;
         public XtraForm1()
         {
             InitializeComponent();
-            // 鍒濆鍖栬〃鍗�
-            this.Text = "Draggable Panel Example";
-            this.Size = new Size(800, 600);
-
-            // 娣诲姞榧犳爣浜嬩欢澶勭悊绋嬪簭
-            panTuo.MouseDown += new MouseEventHandler(DraggablePanel_MouseDown);
-            panTuo.MouseMove += new MouseEventHandler(DraggablePanel_MouseMove);
-            panTuo.MouseUp += new MouseEventHandler(DraggablePanel_MouseUp);
+           
+            _drapHelp = new DragResizeHelp(this, splitContainerControl1.Panel1);
+            this.xtraTabControl1.CustomHeaderButtonClick += XtraTabControl1_CustomHeaderButtonClick;
         }
-        private void DraggablePanel_MouseDown(object sender, MouseEventArgs e)
+
+        private void XtraTabControl1_CustomHeaderButtonClick(object sender, DevExpress.XtraTab.ViewInfo.CustomHeaderButtonEventArgs e)
         {
-            if (e.Button == MouseButtons.Left)
-            {
-                isDragging = true;
-                dragCursorPoint = Cursor.Position;
-                dragPanelPoint = panTuo.Location;
-                panTuo.Cursor = Cursors.SizeAll;
-
-            }
+            _drapHelp.Show();
         }
 
-        private void DraggablePanel_MouseMove(object sender, MouseEventArgs e)
-        {
-            if (isDragging)
-            {
-              
-                panTuo.Location = new Point(
-                    dragPanelPoint.X + Cursor.Position.X - dragCursorPoint.X,
-                    dragPanelPoint.Y + Cursor.Position.Y - dragCursorPoint.Y);
-                Point newLocation = panTuo.Location;
-                Rectangle bounds = panelControl1.Bounds;
-                lbMsg.Text = panTuo.Location.ToString() + "-" + bounds.ToString();
-                
-                if (IsOutsideBounds(panTuo, panelControl1))
-                {
-                    lbMsg.Text = "瓒呬簡";
-                     panelControl1.Controls.Remove(panTuo);
-                    dockPanel1.Controls.Add(panTuo);
-
-                    panTuo.Location = new Point(
-                       Math.Max(0, Math.Min(dockPanel1.Width - panTuo.Width, newLocation.X - dockPanel1.Location.X)),
-                       Math.Max(0, Math.Min(dockPanel1.Height - panTuo.Height, newLocation.Y - dockPanel1.Location.Y)));
-                }
-                else
-                {
-                    lbMsg.Text = panTuo.Location.ToString() + "-" + bounds.ToString();
-                }
-            }
-
-
-        }
-        public static bool IsOutsideBounds(Control child, Control parent)
-        {
-            // 鑾峰彇鎺т欢鐩稿浜庡叾鐖跺鍣ㄧ殑浣嶇疆鍜屽ぇ灏�
-            Rectangle childBounds = new Rectangle(child.Location, child.Size);
-            Rectangle parentBounds = new Rectangle(Point.Empty, parent.ClientSize); // 浣跨敤ClientSize鑾峰彇瀹瑰櫒鐨勫伐浣滃尯澶у皬
-
-            // 娉ㄦ剰锛氳繖閲屾垜浠亣璁綾hild鏄痯arent鐨勭洿鎺ュ瓙鎺т欢锛屽洜姝hild.Location鏄浉瀵逛簬parent鐨勩��
-            // 濡傛灉child涓嶆槸parent鐨勭洿鎺ュ瓙鎺т欢锛屼綘闇�瑕佸厛鎵惧埌child鐩稿浜巔arent鐨勭浉瀵逛綅缃��
-
-            // 妫�鏌hildBounds鏄惁瓒呭嚭浜唒arentBounds鐨勪换浣曚竴涓竟鐣�
-            return !parentBounds.Contains(childBounds);
-        }
-
-        private void DraggablePanel_MouseUp(object sender, MouseEventArgs e)
-        {
-            if (e.Button == MouseButtons.Left)
-            {
-                isDragging = false;
-            }
-        }
-
-
+     
+    
     }
-
 }
\ No newline at end of file

--
Gitblit v1.9.3