예제 #1
0
        protected override void SetChildrenProperties()
        {
            base.SetChildrenProperties();

            background.Location   = Location;
            background.Size       = Size;
            background.TintColour = BackgroundColour;

            provincesItem.ForegroundColour = ForegroundColour;
            provincesItem.Location         = new Point2D(Location.X + Spacing, Location.Y + (Size.Height - provincesItem.ClientRectangle.Height) / 2);
            provincesItem.Size             = new Size2D((Size.Width - Spacing * 3) / 4, 16);
            provincesItem.Text             = Provinces.ToString();

            holdingsItem.ForegroundColour = ForegroundColour;
            holdingsItem.Location         = new Point2D(provincesItem.ClientRectangle.Right + Spacing, provincesItem.Location.Y);
            holdingsItem.Size             = new Size2D((Size.Width - Spacing * 3) / 4, 16);
            holdingsItem.Text             = Holdings.ToString();

            wealthItem.ForegroundColour = ForegroundColour;
            wealthItem.Location         = new Point2D(holdingsItem.ClientRectangle.Right + Spacing, holdingsItem.Location.Y);
            wealthItem.Size             = new Size2D((Size.Width - Spacing * 3) / 4, 16);
            wealthItem.Text             = Wealth.ToString();

            troopsItem.ForegroundColour = ForegroundColour;
            troopsItem.Location         = new Point2D(wealthItem.ClientRectangle.Right + Spacing, wealthItem.Location.Y);
            troopsItem.Size             = new Size2D((Size.Width - Spacing * 3) / 4, 16);
            troopsItem.Text             = "0";

            provincesTooltip.Location = new Point2D(provincesItem.Location.X, ClientRectangle.Bottom);
            holdingsTooltip.Location  = new Point2D(holdingsItem.Location.X, ClientRectangle.Bottom);
            wealthTooltip.Location    = new Point2D(wealthItem.Location.X, ClientRectangle.Bottom);
            troopsTooltip.Location    = new Point2D(troopsItem.Location.X, ClientRectangle.Bottom);

            troopsTooltip.Text = string.Empty;

            if (Troops != null && Troops.Count > 0)
            {
                troopsItem.Text = Troops.Values.Sum().ToString();
                Troops.ToList().ForEach(t => troopsTooltip.Text += $"{t.Key}: {t.Value}\n");
            }
        }