public void CreateLabels(EventHandler onClick) { _repairLabels = new RepairLabels[Lines]; SuspendLayout(); for (var i = 0; i < _repairLabels.Length; i++) { var y = PanelPadding + 1 + i * LineHeight; const int height = 12; _repairLabels[i] = new RepairLabels { Fleet = new ShipLabel.Fleet(new Point(0, y)), Name = new ShipLabel.Name(new Point(9, y), ShipNameWidth.RepairList), Damage = new ShipLabel.Hp { Location = new Point(119, y), Size = new Size(5, height - 1) }, Time = new ShipLabel.RepairTime(new Point(75, y)), BackGround = new Label { Location = new Point(0, y - 1), Size = new Size(Width, height + 2) } }; _repairLabels[i].Arrange(this, CustomColors.ColumnColors.BrightFirst(i)); _repairLabels[i].Scale(); _repairLabels[i].SetClickHandler(onClick); } ResumeLayout(); SetupListScroller(); }
public void CreateLabels(int i) { var y = ShipListPanel.LineHeight * i + 1; const int height = ShipListPanel.LabelHeight; var labels = new RepairLabels { Fleet = new ShipLabel.Fleet(new Point(1, 2)), Name = new ShipLabel.Name(new Point(10, 2), ShipNameWidth.RepairListFull), Hp = new ShipLabel.Hp(new Point(118, 0), ShipListPanel.LineHeight), Level = new ShipLabel.Level(new Point(116, 2), height), Time = new ShipLabel.RepairTime(new Point(141, 2)), PerHp = new Label { Location = new Point(185, 2), AutoSize = true }, BackPanel = new Panel { Location = new Point(0, y), Size = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight), Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top } }; SetAnchorRight(labels.Hp, labels.Level, labels.Time, labels.PerHp); _labelList.Add(labels); labels.Arrange(_shipListPanel, CustomColors.ColumnColors.BrightFirst(i)); labels.Scale(); _shipListPanel.SetHpPercent(labels.Hp); }