/// <summary> /// Automatically locates the control relatively to the parent /// </summary> /// <param name="ds"></param> public void Locate(ControlDock ds) { if (ds.HasFlag(ControlDock.HorisontalLeft)) { Bounds.Location.X = parent.Bounds.Location.X.Offset; } if (ds.HasFlag(ControlDock.HorisontalCenter)) { Bounds.Location.X = parent.Bounds.Location.X + (parent.Bounds.Size.X - Bounds.Size.X) / 2; } if (ds.HasFlag(ControlDock.HorisontalRight)) { Bounds.Location.X = parent.Bounds.Location.X.Offset + (parent.Bounds.Size.X.Offset - Bounds.Size.X.Offset); } if (ds.HasFlag(ControlDock.VerticalTop)) { Bounds.Location.Y = parent.Bounds.Location.Y.Offset; } if (ds.HasFlag(ControlDock.VerticalCenter)) { Bounds.Location.Y = parent.Bounds.Location.Y.Offset + (parent.Bounds.Size.Y.Offset - Bounds.Size.Y.Offset) / 2; } if (ds.HasFlag(ControlDock.VerticalBottom)) { Bounds.Location.Y = parent.Bounds.Location.Y + (parent.Bounds.Size.Y - Bounds.Size.Y); } }
private void addControlDock() { ControlDock.SubscribeControlsToDragEvents(new Control[] { bunifuGradientPanel1, tabSignUp, tabSignIn, tabALL, pictureBox1, pictureBox2, bunifuLabel1, bunifuLabel2, bunifuLabel3 }, false); }