private void FillData(CellProperTable cpt) { if (cpt.KeyValueTable.Count == 0) { return; } DataTable dt = new DataTable(); List<string> keyList = cpt.KeyValueTable.Keys.ToList(); for(int i = 0; i < keyList.Count; ++i) { string key = keyList[i]; dt.Columns.Add(key); } for (int i = 0; i < cpt.Row; ++i) { DataRow dr = dt.NewRow(); for (int j = 0; j < cpt.Col; ++j) { dr[keyList[j]] = cpt.KeyValueTable[keyList[j]][i]; } dt.Rows.Add(dr); } dataGridView1.DataSource = dt; }
public CellProperty(ViewerResultGraph vqg) { InitializeComponent(); InitializeLayout(); CellProperTable cpt = new CellProperTable(vqg); FillData(cpt); }