public HobbyProjects() { InitializeComponent(); mainMenu = MenuBuilderFactory.Build <UserControl>(mainMenuPanel, MenuLayout.vertical, MenuLocation.left, appearance: MenuAppearance.GetDefaultAppearance() .SetTabSize(new Size(150, 50)) .SetTabBackColor(Color.FromArgb(50, 50, 50)) .SetTabFont(Font) .SetTabBorderColor(Color.White) .SetTextColor(Color.White), eventFunction: OnTabChange); mainMenu.CreateTab("Game of Life", new GameOfLife()); mainMenu.CreateTab("Dot Product", new UserControl()); mainMenu.CreateTab("Mazes", new UserControl()); mainMenu.ChangeTab(0); }
/// <summary> /// Handles the user clicking on the control /// </summary> /// <param name="menu">The menu to handle on</param> /// <param name="location">The location on the control the user clicked</param> /// <param name="tabSize">The size of a tab</param> public void HandleClick <T>(IMenu <T> menu, Point location, Size tabSize) { var index = location.Y / tabSize.Height; menu.ChangeTab(index); }