public void LoadButtons(string screen, PlanClickCallback callback) { Controls.Clear(); buttons = DB.Execute.ReadPlanButtons(screen); setFlowBreak = buttons.Count < 6; if (setFlowBreak) { int x = (Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth) / 2; Padding = new Padding(x, 250, 0, 0); } else { Padding = new Padding(50, 150, 50, 0); } foreach (var button in buttons) { string text = Tools.ReadPlanResource(button.Key); CommandButton command = new CommandButton(text) { Tag = button.Value }; command.MouseUp += OnCommandClick; Controls.Add(command); } if (PlanClick == null) { PlanClick += callback; } }
public PlanPanel(string screen, PlanClickCallback callback) { Dock = DockStyle.Fill; BackColor = Color.Transparent; int x = (Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth) / 2; Name = screen; FlowDirection = FlowDirection.RightToLeft; LoadButtons(screen, callback); }