日期:2014-05-17 浏览次数:20955 次
private void dgvColumnsBindC()
{
this.rmvItem.EnableHeadersVisualStyles = false;
this.rmvItem.AutoGenerateColumns = false;
this.rmvItem.Columns.Clear();//列头清空下
Dictionary<string, string> dataText = new Dictionary<string, string>();
dataText.Add("ItemName", "考核类型");
dataText.Add("IName", "考核项目");
dataText.Add("Weights", "权重");
dataText.Add("Description", "考核明细");
dataText.Add("Scores", "分值");
foreach (KeyValuePair<string, string> kvp in dataText)
{
DataGridViewTextBoxColumn dgvc = new DataGridViewTextBoxColumn();
dgvc.DataPropertyName = kvp.Key;
dgvc.HeaderText = kvp.Value;
dgvc.Name = kvp.Key;
dgvc.ReadOnly = true;
if (kvp.Value == "权重" || kvp.Value == "分值") dgvc.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
if (kvp.Value == "考核类型" || kvp.Value == "考核项目") dgvc.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
if (kvp.Value == "考核明细") dgvc.DefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dgvc.HeaderCell.Style.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;//居中
dgvc.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
if (kvp.Value == "权重" || kvp.Value