using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Lskj.ProductPlatform2 { public partial class PageBar : UserControl { public List ToolButtonList = new List();//全部选项 public Dictionary> bonuttPaging = new Dictionary>();//每页对于的选项 public PageBar() { InitializeComponent(); } public void addButtons(List ToolButtons) { int panelWidth = this.panelDisplay1.Width; int panelheight = this.panelDisplay1.Height; int tbx = 5; int tby = 5; int NumberPages = 0; foreach (ToolButton tb in ToolButtons) { if (panelWidth > (tbx + tb.Width)) { //换列 tbx += 5; } else { //换行 tbx = 5; tby += tb.Height + 5; } tb.Location = new Point(tbx, tby); tbx += tb.Width; panelDisplay1.Controls.Add(tb); } } } }