private TabPage GetTabPage(String Key) { var newTab = new TabPage() { Text = pollsDataSet.TYPES.First(c=>c.TYPE==Key).NAME, Name = Key}; var splitQI = new SplitContainer() { Dock = DockStyle.Fill, Orientation = Orientation.Horizontal, Name = "SplitQI", AutoSize = true, AutoScroll = true }; newTab.Controls.Add(splitQI); if (Key == "TRANS") { var panelTrans = new Panel() { Size = new Size() { Height = 30, Width = 200 }, Dock = DockStyle.Top }; _transComboBox = new ComponentsComboBox(); _transComboBox.label.Text = "Тип перевода:"; _transComboBox.comboBox.DropDownStyle = ComboBoxStyle.DropDownList; var transTypeBinding = new BindingSource(); transTypeBinding.DataSource = pollsDataSet; transTypeBinding.DataMember = "TransTypes"; _transComboBox.comboBox.DataSource = transTypeBinding; _transComboBox.comboBox.DisplayMember = "NameTransType"; _transComboBox.comboBox.ValueMember = "IdTransType"; panelTrans.Controls.Add(_transComboBox); newTab.Controls.Add(panelTrans); } var rbDictQ = new Dictionary<String,RowRadioButtons>(); var rbDictI = new Dictionary<String,RowRadioButtons>(); var typePolls = new TYPEPOLLSTableAdapter(); typePolls.Fill(pollsDataSet.TYPEPOLLS); var qPollRadioTable = new PollRadioTable() { Name = "QTABLE", AutoSize = true, AutoSizeMode = AutoSizeMode.GrowOnly,Dock = DockStyle.Fill ,AutoScroll = true}; var iPollRadioTable = new PollRadioTable() { Name = "ITABLE", AutoSize = true, AutoSizeMode = AutoSizeMode.GrowOnly, Dock = DockStyle.Fill, AutoScroll = true }; //qPollRadioTable.AddRow("HEADERS"); var qHeadersRow = new GroupeRow(){Dock = DockStyle.Fill}; var iHeadersRow = new GroupeRow() { Dock = DockStyle.Fill }; qHeadersRow.tableLayoutPanel.RowStyles[0].SizeType = SizeType.Absolute; iHeadersRow.tableLayoutPanel.RowStyles[0].SizeType = SizeType.Absolute; for (int j = 0; j < qHeadersRow.tableLayoutPanel.ColumnCount && j < iHeadersRow.tableLayoutPanel.ColumnCount; j++) { //qPollRadioTable.tableLayoutPanel.Controls["HEADERS"].Controls.Add(); //qPollRadioTable.tableLayoutPanel.Controls.Add(new Label {Text = _qTexts[j-1],TextAlign = ContentAlignment.MiddleCenter,AutoSize=true},j,0); var qHeaderLabel = new Label() { Text = _qTexts[j], Name = "Header" + j, TextAlign = ContentAlignment.MiddleCenter, AutoSize = true, Dock = DockStyle.Fill }; var iHeaderLabel = new Label() { Text = _iTexts[j], Name = "Header" + j, TextAlign = ContentAlignment.MiddleCenter, AutoSize = true, Dock = DockStyle.Fill }; qHeadersRow.tableLayoutPanel.Controls.Add(qHeaderLabel , j, 0); iHeadersRow.tableLayoutPanel.Controls.Add(iHeaderLabel, j, 0); //qHeadersRow.tableLayoutPanel.Controls["Header" + j].AutoSize = true; // Console.WriteLine("Header " + j + " " + qHeadersRow.tableLayoutPanel.Controls["Header" + j].Height + "x" + qHeadersRow.tableLayoutPanel.Controls["Header" + j].Width); //qHeadersRow.tableLayoutPanel.AutoSize //qPollRadioTable.tableLayoutPanel.Controls[] } qHeadersRow.tableLayoutPanel.RowStyles[0].Height = 30; iHeadersRow.tableLayoutPanel.RowStyles[0].Height = 30; //qHeadersRow.tableLayoutPanel.RowStyles[0].SizeType = SizeType.Absolute; int i = 0; qHeadersRow.tableLayoutPanel.AutoSize = true; iHeadersRow.tableLayoutPanel.AutoSize = true; //qHeadersRow.tableLayoutPanel.LayoutSettings.RowStyles[0].SizeType = SizeType.AutoSize; qPollRadioTable.tableLayoutPanel.Controls.Add(qHeadersRow,1,0); iPollRadioTable.tableLayoutPanel.Controls.Add(iHeadersRow, 1, 0); qHeadersRow.AutoSize = true; iHeadersRow.AutoSize = true; Console.WriteLine("Header "+qHeadersRow.Height); foreach (var currentRow in pollsDataSet.TYPEPOLLS.Where(c=>c.TYPE==Key)) { var qRadioRow = new RowRadioButtons(5){Text = currentRow.NAMEQUEST}; //qRadioRow.Mark[0].Text = "Совершенно удовлетворен"; //qRadioRow.Mark[1].Text = "Скорее удовлетворен"; //qRadioRow.Mark[2].Text = "В целом меня все устраивает"; //qRadioRow.Mark[3].Text = "Скорее не удовлетворен"; //qRadioRow.Mark[4].Text = "Совершенно не удовлетворен"; rbDictQ.Add(currentRow.IDQUEST,qRadioRow); var iRadioRow = new RowRadioButtons(5){Text = currentRow.NAMEQUEST}; //iRadioRow.Mark[0].Text = "Очень важно"; //iRadioRow.Mark[1].Text = "Скорее важно"; //iRadioRow.Mark[2].Text = "Имеет нейтральное значение"; //iRadioRow.Mark[3].Text = "Скорее неважно"; //iRadioRow.Mark[4].Text = "Совершенно неважно"; rbDictI.Add(currentRow.IDQUEST,iRadioRow); qPollRadioTable.tableLayoutPanel.Controls.Add(new Label(){Name = currentRow.IDQUEST,Text = qRadioRow.Text,AutoSize = true,Height = 0},0,i+1); iPollRadioTable.tableLayoutPanel.Controls.Add(new Label() { Name = currentRow.IDQUEST, Text = qRadioRow.Text, AutoSize = true, Height = 0 }, 0, i + 1); var qCurentRadioRow = new GroupeRow() { Dock = DockStyle.Fill, Name = "R" + currentRow.IDQUEST }; var iCurentRadioRow = new GroupeRow() { Dock = DockStyle.Fill, Name = "R" + currentRow.IDQUEST }; for (int j = 0; j < 5; j++) { //qPollRadioTable.tableLayoutPanel.Controls.Add(qRadioRow.Mark[j], j + 1, i+1); ////qPollRadioTable.tableLayoutPanel.RowStyles[i + 1] = new RowStyle(qPollRadioTable.tableLayoutPanel.RowStyles[0]); //iPollRadioTable.tableLayoutPanel.Controls.Add(iRadioRow.Mark[j], j + 1, i+1); qCurentRadioRow.tableLayoutPanel.Controls.Add(qRadioRow.Mark[j], j, 0); iCurentRadioRow.tableLayoutPanel.Controls.Add(iRadioRow.Mark[j], j, 0); } qPollRadioTable.tableLayoutPanel.Controls.Add(qCurentRadioRow, 1, i + 1); iPollRadioTable.tableLayoutPanel.Controls.Add(iCurentRadioRow, 1, i + 1); i++; } //if (newTab.Name != "TRANS") //{ // var newTableControls = new TableLayoutPanel(); qPollRadioTable.BorderStyle = BorderStyle.FixedSingle; //qPollRadioTable.MaximumSize.Width //= splitQI.Panel1.Size.Width - 4; qPollRadioTable.AutoSize = true; qPollRadioTable.tableLayoutPanel.AutoSize = true; iPollRadioTable.BorderStyle = BorderStyle.FixedSingle; splitQI.Panel1.Controls.Add(qPollRadioTable); //splitQI.Panel1.AutoSize = true; //splitQI.Panel1.Dock = DockStyle.Fill; //splitQI.Panel1.AutoScroll = true; //splitQI.Panel1.Controls[newTab.Controls.IndexOfKey("QTABLE")].Dock = DockStyle.Fill; qPollRadioTable.tableLayoutPanel.AutoScroll = true; iPollRadioTable.tableLayoutPanel.AutoScroll = true; splitQI.Panel2.Controls.Add(iPollRadioTable); //splitQI.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; //newTab.Controls[newTab.Controls.IndexOfKey("ITABLE")].Dock = DockStyle.Bottom; newTab.AutoSizeMode = AutoSizeMode.GrowOnly; newTab.AutoSize = true; newTab.AutoScroll = true; //tabControlPolls.TabPages[pollsDataSet.TYPES[index].TYPE] //} return newTab; }
private void FillTabPage(String Key) { var newTab = tabControlPolls.TabPages[Key]; //var newTab = new TabPage(pollsDataSet.TYPES[index].TYPE) { Text = pollsDataSet.TYPES[index].NAME }; var rbDictQ = new Dictionary<String, RowRadioButtons>(); var rbDictI = new Dictionary<String, RowRadioButtons>(); var splitQI = new SplitContainer() {Dock = DockStyle.Fill, Orientation = Orientation.Horizontal, Name = "SplitQI"}; newTab.Controls.Add(splitQI); //splitQI.Panel1.Controls.Add(new Label(){Text = "Test"}); var qPollRadioTable = new PollRadioTable() { Name = "QTABLE", AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, BorderStyle = BorderStyle.Fixed3D, Dock = DockStyle.Fill }; var iPollRadioTable = new PollRadioTable() { Name = "ITABLE", AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, BorderStyle = BorderStyle.Fixed3D, Dock = DockStyle.Fill }; int i = 0; var typePolls = new TYPEPOLLSTableAdapter(); typePolls.Fill(pollsDataSet.TYPEPOLLS); foreach (var currentRow in pollsDataSet.TYPEPOLLS.Where(c => c.TYPE == newTab.Name)) { var qRadioRow = new RowRadioButtons(5) { Text = currentRow.NAMEQUEST }; qRadioRow.Mark[0].Text = "Совершенно удовлетворен"; qRadioRow.Mark[1].Text = "Скорее удовлетворен"; qRadioRow.Mark[2].Text = "В целом меня все устраивает"; qRadioRow.Mark[3].Text = "Скорее не удовлетворен"; qRadioRow.Mark[4].Text = "Совершенно не удовлетворен"; rbDictQ.Add(currentRow.IDQUEST, qRadioRow); var iRadioRow = new RowRadioButtons(5) { Text = currentRow.NAMEQUEST }; iRadioRow.Mark[0].Text = "Очень важно"; iRadioRow.Mark[1].Text = "Скорее важно"; iRadioRow.Mark[2].Text = "Имеет нейтральное значение"; iRadioRow.Mark[3].Text = "Скорее неважно"; iRadioRow.Mark[4].Text = "Совершенно неважно"; rbDictI.Add(currentRow.IDQUEST, iRadioRow); qPollRadioTable.tableLayoutPanel.Controls.Add(new Label() { Name = currentRow.IDQUEST, Text = qRadioRow.Text }, 0, i + 1); for (int j = 0; j < 5; j++) { qPollRadioTable.tableLayoutPanel.Controls.Add(qRadioRow.Mark[j], j + 1, i+1); iPollRadioTable.tableLayoutPanel.Controls.Add(iRadioRow.Mark[j], j + 1, i+1); } i++; } if (newTab.Name != "TRANS") { // var newTableControls = new TableLayoutPanel(); //splitQI.Panel1.Controls.Add(qPollRadioTable); //splitQI.Panel1.Controls[newTab.Controls.IndexOfKey("QTABLE")].Dock = DockStyle.Fill; splitQI.Panel1MinSize = splitQI.Size.Height - splitQI.SplitterWidth; //splitQI.Panel2.Controls.Add(iPollRadioTable); //splitQI.Panel2.Controls[newTab.Controls.IndexOfKey("ITABLE")].Dock = DockStyle.Fill; splitQI.Panel2MinSize = splitQI.Size.Height - splitQI.SplitterWidth; splitQI.AutoSize = true; splitQI.Dock = DockStyle.Fill; newTab.AutoSizeMode = AutoSizeMode.GrowAndShrink; newTab.AutoSize = true; newTab.AutoScroll = true; newTab.Dock = DockStyle.Fill; //tabControlPolls.TabPages[pollsDataSet.TYPES[index].TYPE] } //return newTab; }