public void Add(string item, EventHandler handler) { if (Buttons.Count == Buttons.Capacity) throw new ArgumentException("Maximum menu capacity exceeded."); Button button = new Button( item, new Style { Dimension = new Dimension(200, 50), Position = new Point(Position.X, Position.Y + Buttons.Count * 65), Material = "Core/StatsBlockCenter" }, new Style { Dimension = new Dimension(160, 40), Position = new Point(10, 20), FontSize = 26, Color = ColourValue.White, Font = "BlueHighway" } ); button.Clicked += handler; Buttons.Add(button); }
protected override void OnUserInterfaceCreate() { base.OnUserInterfaceCreate(); FontManager.Singleton.GetByName("BlueHighway").Load(); StartButton = new Button( "Start", new Style { Dimension = new Dimension(200, 70), Position = new Point(400, 300), Material = "Core/StatsBlockCenter" }, new Style { Dimension = new Dimension(150, 50), Position = new Point(20, 20), FontSize = 20, Color = ColourValue.White, Font = "BlueHighway" } ); StartButton.Clicked += new EventHandler(OnStartClick); UserInterface.Add(StartButton); }