public void ShowLevel(String Level) { if (CurrentLevelShown != null) { CloseLevel(CurrentLevelShown); } CurrentLevelShown = Level; ChangeCentreImage(Level); String[] AllSectionNames = DockItemSettings.GetSectionNames(); ArrayList NewDockItems = new ArrayList(); for (int i = 0; i < AllSectionNames.Length; i++) { if (AllSectionNames[i].StartsWith(Level) && AllSectionNames[i].Substring(Level.Length, AllSectionNames[i].Length - Level.Length).Contains("-") == false) { //Console.WriteLine("name: " + AllSectionNames[i]); BaseDockObjects.DockItemObject NewDockItem = CreateDockItem(AllSectionNames[i], null); NewDockItems.Add(NewDockItem); } } NewDockItemSizes = new Size[NewDockItems.Count]; for (int i = 0; i < NewDockItems.Count; i++) { BaseDockObjects.DockItemObject tempDockItem = (BaseDockObjects.DockItemObject)NewDockItems[i]; NewDockItemSizes[i] = tempDockItem.ObjectSize; } //Size tempBackgroundObjectSize = BackgroundObject.ObjectSize; //tempBackgroundObjectSize = new Size(NewDockItems.Count * DockSettings.DockItemSize.DefaultWidth / 2, NewDockItems.Count * DockSettings.DockItemSize.DefaultWidth / 2); //BackgroundObject.Hide(); //BackgroundObject.SuspendLayout(); //BackgroundObject.Location = new Point(SystemInformation.VirtualScreen.Right / 2 - tempBackgroundObjectSize.Width / 2, // SystemInformation.VirtualScreen.Bottom / 2 - tempBackgroundObjectSize.Height / 2); //BackgroundObject.ResumeLayout(); //BackgroundObject.DrawBitmapManaged(tempBackgroundObjectSize.Width, tempBackgroundObjectSize.Height, false, 0, 0, false, 0, 0, 0, 0); //BackgroundObject.Show(); CalculatedPoints = CalculateDockItemPositions(NewDockItemSizes); for (int i = 0; i < NewDockItems.Count; i++) { BaseDockObjects.DockItemObject tempDockItem = (BaseDockObjects.DockItemObject)NewDockItems[i]; tempDockItem.DrawBitmapManaged(NewDockItemSizes[i].Width, NewDockItemSizes[i].Height, true, CalculatedPoints[i].X, CalculatedPoints[i].Y, false, 0, 0, 0, 0, false, 0); } }
public BaseDockObjects.DockItemObject ShowDockItem(String SectionName, String Path) { Size tempSize = new Size(DockSettings.DockItemSize.DefaultWidth, DockSettings.DockItemSize.DefaultHeight); BaseDockObjects.DockItemObject NewDockItem = new BaseDockObjects.DockItemObject(this, LanguageWords, DockSettings, DockItemSettings, SectionName, tempSize, Path); NewDockItem.Owner = BackgroundObject; Size tempBackgroundObjectSize = BackgroundObject.ObjectSize; NewDockItem.Location = new Point(BackgroundObject.Location.X + tempBackgroundObjectSize.Width / 2 - tempSize.Width / 2, BackgroundObject.Location.Y + tempBackgroundObjectSize.Height / 2 - tempSize.Height / 2); NewDockItem.DrawBitmapManaged(tempSize.Width, tempSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0); NewDockItem.Show(); NewDockItem.BringToFront(); MainDockObjects.Add(NewDockItem); return(NewDockItem); }