lu
2025-03-01 c26069c9418efe9f9c0f963f43fb98b8a7440adf
DevApp/Gs.DevApp/ToolBox/DragResizeHelp.cs
@@ -21,7 +21,7 @@
        private DevExpress.XtraBars.Docking.DockPanel dockPanel1;
        private DevExpress.XtraBars.Docking.ControlContainer dockPanel1_Container;
        private System.ComponentModel.IContainer components = null;
        private ToolTip toolTip;
        //private ToolTip toolTip;
        #endregion
        #region Inner Object
        private enum EnumMousePointPosition
@@ -40,7 +40,7 @@
        #endregion
        public DragResizeHelp(DevExpress.XtraEditors.XtraForm frm, Control regBox)
        {
            toolTip = new ToolTip();
          //  toolTip = new ToolTip();
            this.components = new System.ComponentModel.Container();
            dragBox1 = regBox;
            this.components = new System.ComponentModel.Container();
@@ -180,7 +180,7 @@
                    //   isDragging = false;
                    dragBoxCurrentName = dockPanel1_Container.Name;
                }
                reloadLoaction(null);
              //  reloadLoaction(null);
            }
            else if (dockPanel1_Container.Name == dragBoxCurrentName)
            {
@@ -227,7 +227,7 @@
                });
                menu.Items.Add($"一键重排", null, (ss, ee) =>
                {
                    frm.ShowDialog();
                    reloadLoaction((sender as Control).Parent);
                });
                menu.Show(control, e.Location);
            }
@@ -366,7 +366,7 @@
                int height = control.Height;
                Point[] ps =  { new Point(0, 0),new Point(width - 1, 0),
                new Point(width - 1, height - 1),new Point(0, height - 1),new Point(0, 0) };
                g.DrawLines(new Pen(Color.LightCoral), ps);
                g.DrawLines(new Pen(Color.Pink), ps);
            }
            //  reloadLoaction();
            reloadMsg(lCtrl);
@@ -476,6 +476,7 @@
        private void reloadLoaction(Control cocccc)
        {
            int _top = 0;
            //如果是控件箱,不移Left
            if (dockPanel1_Container.Name == dragBoxCurrentName)
            {
                foreach (Control col in dockPanel1_Container.Controls)
@@ -487,19 +488,22 @@
                return;
            }
            if (cocccc == null) return;
            int x = 15;
            int y = 15;
            //这是容器
            int x = 2;
            int y = 2;
            foreach (Control btn in dragBox1.Controls)
            {
                if (cocccc.Name == btn.Name)
                    continue;
                //btn.Left = x;
                //btn.Top = y;
                x += btn.Width + 15;
                if (cocccc.Visible ==false)
                    continue;
                btn.Left = x;
                btn.Top = y;
                x += btn.Width + 2;
                if (btn.Width > dragBox1.Width - x)
                {
                    x = 15;
                    y += btn.Height + 15;
                    x = 2;
                    y += btn.Height +2;
                }
            }
            cocccc.Left = x;
@@ -515,7 +519,7 @@
            sb.Append(string.IsNullOrEmpty(dragBoxCurrentName) ? "表单中" : "组件箱中");
            sb.Append(",坐标:" + cocccc.Location.ToString());
            sb.Append(",大小:" + cocccc.Size.ToString());
            toolTip.SetToolTip(ctrlCurrentObj, sb.ToString());
           // toolTip.SetToolTip(ctrlCurrentObj, sb.ToString());
        }
    }
}