public void ChildMoved(BaseDockObjects.CentreObject ChildObject) { CalculatedPoints = CalculateDockItemPositions(NewDockItemSizes); SetDockItemPositions(CalculatedPoints); Application.DoEvents(); Size BackgroundSize = BackgroundObject.ObjectSize; Size CentreObjectSize = CentreObject.ObjectSize; BackgroundObject.Location = new Point(CentreObject.Location.X - (BackgroundSize.Width / 2 - CentreObjectSize.Width / 2), CentreObject.Location.Y - (BackgroundSize.Height / 2 - CentreObjectSize.Height / 2)); }
public void InitializeCentreObject() { Size tempSize = new Size(DockSettings.CentreImage.Width, DockSettings.CentreImage.Height); CentreObject = new BaseDockObjects.CentreObject(this, LanguageWords, DockSettings, "CentreImage", tempSize); //CentreObject.TopLevel = false; //CentreObject.Parent = BackgroundObject; CentreObject.Owner = BackgroundObject; // MainForm handles all the location and sizing of the objects //Size tempBackgroundObjectSize = BackgroundObject.ObjectSize; //CentreObject.Location = new Point(BackgroundObject.Location.X + tempBackgroundObjectSize.Width / 2 - tempSize.Width / 2, // BackgroundObject.Location.Y + tempBackgroundObjectSize.Height / 2 - tempSize.Height / 2); CentreObject.Location = new Point(SystemInformation.VirtualScreen.Right / 2 - tempSize.Width / 2, SystemInformation.VirtualScreen.Bottom / 2 - tempSize.Height / 2); CentreObject.DrawBitmapManaged(tempSize.Width, tempSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0); CentreObject.Show(); CentreObject.BringToFront(); }