sharan

sharan

  • NA
  • 1
  • 1.1k

resizing of dynamic controls in datagridview

Feb 3 2014 1:12 PM
i develop a win form in c#, and i created dynamic textbox and added to a datagridview column.now my problem is when i run the form textbox is placed at correct position, and when i maximize the form textbox is not added to the required column.here is my code
 
private void Former_Transactons_Load(object sender, EventArgs e)
{
TextBox tx1 = new TextBox();
Rectangle rect = dataGridView1.GetCellDisplayRectangle(8, -1, true);
rect.X = rect.Location.X + (rect.Width-22);
rect.Y = 10;
tx1.Size = new Size(20, 21);
//tx1.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
tx1.Location = rect.Location;
dataGridView1.Controls.Add(tx1);
}