私はWinFormアプリケーションでDataGridViewを使用してデータテーブルを表示しています。 DataColumnのCaptionプロパティを除いて、すべて正常に動作します。私はCaptionプロパティを設定しようとしましたが、DataGridViewは、Captionプロパティの値の代わりに、キャプションとしてDataColumnの名前を使用しているようですか?DataGridViewのキャプションを設定する方法
これはgoogleです。このキャプションのプロパティは意図的に無効になっているようです。
私のWinFormアプリケーションはローカライズされたもので、キャプションを中国語で表示する必要があります。誰でも私はどのようにそれを行うことができますか?ここで
は、あなたはいくつかのオプションを持っているデータテーブル
// Create a new DataTable.
DataTable table = new DataTable("Payments");
// Declare variables for DataColumn and DataRow objects.
DataColumn column;
DataRow row;
// Create new DataColumn, set DataType,
// ColumnName and add to DataTable.
column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.ColumnName = "id";
column.ReadOnly = true;
column.Unique = true;
column.Caption = LocalizedCaption.get("id") //LocalizedCaption is my library to retrieve the chinese caption
// Add the Column to the DataColumnCollection.
table.Columns.Add(column);
// Create three new DataRow objects and add them to the DataTable
for (int i = 0; i <= 2; i++)
{
row = table.NewRow();
row["id"] = i;
table.Rows.Add(row);
}
//assign the DataTable as the datasource for a DataGridView
dataGridView1.DataSource = table;