DataGridview RowTemplate 表の操作

// 意外と利用されていないプロパティー

RowTemplateは各種設定がいろいろできます。

セルの幅など、その他いろいろ。

 

// 列が自動的に作成されないようにする

dataGridView1.AutoGenerateColumns = false;

// セルの背景を任意の色に設定する

dataGridView1[0, 0].Style.BackColor = Color.Pink;

 

//カーソル位置設定

int x = dataGridView1.CurrentCell.ColumnIndex; 

int y = dataGridView1.CurrentCell.RowIndex;

dataGridView1.CurrentCell = dataGridView1[x, y];

投稿者: jj