private void initTabPage() { mainTabControl.TabPages.Clear(); mainTabControl.TabPages.Add("0", "Main"); mainTabControl.TabPages[0].AutoScroll = true; for (int i = 0; i < ItemCount; i++) { //Вкладки mainTabControl.TabPages.Add((i + 1).ToString(), " " + (i + 1).ToString()); _itemGraph[i] = new ItemGraph(i); //_itemGraph[i].SetNumber(i + 1); _itemGraph[i].Dock = DockStyle.Fill; mainTabControl.TabPages[i + 1].Controls.Add(_itemGraph[i]); _itemControl[i] = new ItemControl(); //по 5 в ряд int x = (i % 5) * _itemControl[i].Size.Width; int y = (i / 5) * _itemControl[i].Size.Height; _itemControl[i].Location = new Point(x, y); _itemControl[i].SetNumber(i + 1); _itemControl[i].Tag = i; _itemControl[i].ItemClick += itemControl_Click; mainTabControl.TabPages[0].Controls.Add(_itemControl[i]); } pollTimer.Enabled = true; }
private void initTabPage() { mainTabControl.TabPages.Clear(); mainTabControl.TabPages.Add("0", "Main"); mainTabControl.TabPages[0].AutoScroll = true; for (int i = 0; i < ItemCount; i++) { //Вкладки mainTabControl.TabPages.Add((i + 1).ToString(), " " + (i + 1).ToString()); _itemGraph[i] = new ItemGraph(i); //_itemGraph[i].SetNumber(i + 1); _itemGraph[i].Dock = DockStyle.Fill; mainTabControl.TabPages[i + 1].Controls.Add(_itemGraph[i]); _itemControl[i] = new ItemControl(); //по 5 в ряд int x = (i%5)*_itemControl[i].Size.Width; int y = (i/5)*_itemControl[i].Size.Height; _itemControl[i].Location = new Point(x, y); _itemControl[i].SetNumber(i + 1); _itemControl[i].Tag = i; _itemControl[i].ItemClick += itemControl_Click; mainTabControl.TabPages[0].Controls.Add(_itemControl[i]); } pollTimer.Enabled = true; }