Ejemplo n.º 1
0
        public ExtendedStatisticsPanel(List<StatisticsData> subData)
        {
            this.subData = subData;

            InitializeComponent();

            int positionX = MARGIN_TOP;
            foreach (StatisticsData data in subData)
            {
                StatisticItem item = new StatisticItem(data, this);
                item.HighlightOnMouseOver = false;
                item.Clickable = false;
                item.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                item.AutoSize = true;
                item.Top = positionX;

                this.Controls.Add(item);

                // Increment the top position
                positionX += item.Height + SPACING;
            }
        }
        public void Add(List<Statistic> statistics)
        {
            int positionX = topMargin; // Keep track of the position of new labels

            foreach (Statistic stat in statistics)
            {
                // Create the proper control for it
                StatisticItem item = new StatisticItem(stat, this);

                // Initialize properties FIRST!
                item.Top = positionX;
                item.Width = this.ClientSize.Width - 1;
                item.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

                // Add the label to the tab page
                this.Controls.Add(item);

                // Increment the top position
                positionX += item.Height + statisticsSpacing;
            }

            AdjustHeightToFit();
        }