ShadowTextBox CreateSTB() { ShadowTextBox tb = new ShadowTextBox(); tb.Dock = DockStyle.Fill; tb.ShadowText = "Текст"; return(tb); }
private void AddDataRow(Data data, bool disableLayout = true) { if (disableLayout) { tableData.SuspendLayout(); } ComboBox cb = CreateCB("Авто", "Получить"); cb.SelectedIndex = (int)data.Type; tableData.Controls.Add(cb, 0, tableData.RowCount - 1); ShadowTextBox stb = CreateSTB(); stb.Text = data.Prop; tableData.Controls.Add(stb, 1, tableData.RowCount - 1); cb = CreateCB("Равно", "Содержит", "Не содержит", "Начинается с", "Заканчивается на"); cb.SelectedIndex = (int)data.howSearch; tableData.Controls.Add(cb, 2, tableData.RowCount - 1); TextBox tb = CreateTB(); tb.Text = data.Value; tableData.Controls.Add(tb, 3, tableData.RowCount - 1); PictureBox pb = new PictureBox(); pb.Image = Properties.Resources.крест1; pb.SizeMode = PictureBoxSizeMode.CenterImage; pb.Size = new Size(14, 14); pb.Cursor = Cursors.Hand; pb.Dock = DockStyle.Top; pb.Margin = new Padding(3, 6, 3, 3); pb.Tag = data.Id; pb.MouseEnter += PbDel_MouseEnter; pb.MouseLeave += PbDel_MouseLeave; pb.MouseClick += PbDel_MouseClick; tableData.Controls.Add(pb, 4, tableData.RowCount - 1); tableData.RowCount++; tableData.RowStyles.Add(new RowStyle(SizeType.AutoSize)); if (disableLayout) { tableData.ResumeLayout(false); tableData.PerformLayout(); } }