| | |
| | | using System; |
| | | using DevExpress.XtraCharts; |
| | | using System; |
| | | using System.Drawing; |
| | | using System.Windows.Forms; |
| | | |
| | |
| | | dragBox2_Container.Show(); |
| | | } |
| | | #region Public Method |
| | | public static void RegisterControl(DevExpress.XtraEditors.XtraForm frm, Control control, Control box1, Label lbMsg) |
| | | public static void RegisterControl(DevExpress.XtraEditors.XtraForm frm, Control box1, Label lbMsg) |
| | | { |
| | | InitializeComponent(frm); |
| | | if (control != null) |
| | | foreach (Control control in box1.Controls) |
| | | { |
| | | sbMsg = lbMsg; |
| | | dragBox1 = box1; |
| | | dragCurrent_Name = box1.Name; |
| | | control.MouseDown += new MouseEventHandler(control_MouseDown); |
| | | control.MouseLeave += new EventHandler(control_MouseLeave); |
| | | control.MouseMove += new MouseEventHandler(control_MouseMove); |
| | | control.Resize += myPanel_Resize; |
| | | if (control != null) |
| | | { |
| | | sbMsg = lbMsg; |
| | | dragBox1 = box1; |
| | | dragCurrent_Name = box1.Name; |
| | | control.MouseDown += new MouseEventHandler(control_MouseDown); |
| | | control.MouseLeave += new EventHandler(control_MouseLeave); |
| | | control.MouseMove += new MouseEventHandler(control_MouseMove); |
| | | control.MouseUp += Control_MouseUp; |
| | | |
| | | control.Resize += myPanel_Resize; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private static void Control_MouseUp(object sender, MouseEventArgs e) |
| | | { |
| | | (sender as Control).Refresh(); |
| | | } |
| | | |
| | | public static void UnRegisterControl(Control control) |
| | |
| | | p1.Y = e.Y; |
| | | isDragging = true; |
| | | dragCurrent_Name = (sender as Control).Parent.Name; |
| | | |
| | | |
| | | } |
| | | |
| | | private static void myPanel_Resize(object sender, EventArgs e) |
| | |
| | | childControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); |
| | | int newY = (panel.ClientSize.Height - childControl.Height) / 2; |
| | | childControl.Location = new Point(childControl.Location.X, newY); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | control.Refresh(); |
| | | Graphics g = control.CreateGraphics(); |
| | | int width = control.Width; |
| | | 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); |
| | | |
| | | |
| | | } |
| | | |
| | | |