| | |
| | | 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 |
| | |
| | | #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(); |
| | |
| | | // isDragging = false; |
| | | dragBoxCurrentName = dockPanel1_Container.Name; |
| | | } |
| | | reloadLoaction(null); |
| | | // reloadLoaction(null); |
| | | } |
| | | else if (dockPanel1_Container.Name == dragBoxCurrentName) |
| | | { |
| | |
| | | }); |
| | | menu.Items.Add($"一键重排", null, (ss, ee) => |
| | | { |
| | | frm.ShowDialog(); |
| | | reloadLoaction((sender as Control).Parent); |
| | | }); |
| | | menu.Show(control, e.Location); |
| | | } |
| | |
| | | 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); |
| | |
| | | private void reloadLoaction(Control cocccc) |
| | | { |
| | | int _top = 0; |
| | | //如果是控件箱,不移Left |
| | | if (dockPanel1_Container.Name == dragBoxCurrentName) |
| | | { |
| | | foreach (Control col in dockPanel1_Container.Controls) |
| | |
| | | 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; |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |