public void AddYear(int year) { YearButton yearB; Array.Resize<int>(ref m_Years,m_Years.Length + 1); m_Years[m_Years.Length - 1] = year; yearB = new YearButton(year, m_CritGui); yearB.Location = new Point(m_Years.Length * 100, 0); this.YearPanel.Controls.Add(yearB); }
public void AddAllYear(int[] yearList) { if (yearList.Length == 0) { return; } if (this.YearPanel.InvokeRequired == true) { this.YearPanel.Invoke(new VoidListIntArra(AddAllYear), new object[] { yearList }); return; } YearButton yearB; Point pt = new Point(0, 0); this.YearPanel.Size = new Size(yearList.Length * 100, this.YearPanel.Height); this.YearPanel.SuspendLayout(); foreach (int year in yearList) { Array.Resize<int>(ref m_Years, m_Years.Length + 1); m_Years[m_Years.Length - 1] = year; yearB = new YearButton(year, m_CritGui); YearButtonList.Add(yearB); yearB.Location = pt; pt.X = yearB.Location.X + yearB.Width + 20; this.YearPanel.Controls.Add(yearB); // this.YearPanelBack.Size = new Size(this.YearPanelBack.Width, yearB.Height + 20); } this.YearPanel.PerformLayout(); this.YearPanel.ResumeLayout(false); }