Created
September 26, 2022 04:54
-
-
Save devmnj/f55dfe63297b2693407465341f75236d to your computer and use it in GitHub Desktop.
How to place textboxes and other control on Datagridview - C#.Net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try | |
| { | |
| int r_left = 0, r_top = 0; | |
| DataGridViewCell cell; | |
| cell = row.Cells[colLno.Index]; | |
| r_left = dataGridView1.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, false).Left; | |
| r_top = dataGridView1.GetCellDisplayRectangle(cell.ColumnIndex, cell.RowIndex, false).Top; | |
| ctxt_lno.Width = cell.Size.Width; | |
| ctxt_lno.Height = cell.Size.Height; | |
| ctxt_lno.Top = r_top + dataGridView1.Top; | |
| ctxt_lno.Left = r_left + dataGridView1.Left; | |
| ctxt_lno.Text = cell.Value != null ? cell.Value.ToString() : (row.Index + 1).ToString(); | |
| } | |
| catch (Exception) | |
| { | |
| throw; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment