K
K
keldish2021-04-01 07:52:52
C++ / C#
keldish, 2021-04-01 07:52:52

How to set up dataGridView in visual studio?

I don't know what the names of the individual elements are.
I will explain as best I can.
data binding is not
needed, just a table without an additional line of the last line and markers in the form of an asterisk and an arrow,
changing any cell at any time, now if I create (conditionally) 3 columns and 3 rows, then it does not allow me to enter data
, perhaps I wrote it is not clear, it will be easier for me to answer leading questions

removed the bottom line editing also did it remains to remove the arrow
DataGrid.AllowUserToAddRows = false;

dataGridView1.Rows[i].ReadOnly = false;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
keldish, 2021-04-01
@keldish

solved
private void Dgv_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == -1 && e.RowIndex > -1)
{
object o = (sender as DataGridView).Rows[e.RowIndex].HeaderCell.Value;
e.PaintBackground(e.CellBounds, true);
using (SolidBrush br = new SolidBrush(Color.Black))
{
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
e.Graphics.DrawString(o.ToString(),
e.CellStyle.Font, br, e.CellBounds, sf);
}
e.Handled = true;
}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question