[C#] 纯文本查看 复制代码
[/b][/color][color=#000000]/// <summary>
/// 设置Grid的每一列
/// </summary>
private void GridColumnBind()
{
try
{
GridColumn gc = new GridColumn();
gc.Caption = "公告类型";
gc.FieldName = "AnnouncType";
gc.Visible = true;
gc.VisibleIndex = 1;
this.gridView2.Columns.Add(gc);
gc = new GridColumn();
gc.Caption = "是否删除";
gc.FieldName = "IsDel";
gc.Visible = false;
this.gridView2.Columns.Add(gc);
gc = new GridColumn();
gc.Caption = "公告内容";
gc.FieldName = "AnnouncContent";
gc.Visible = true;
gc.VisibleIndex = 2;
this.gridView2.Columns.Add(gc);
gc = new GridColumn();
gc.Caption = "公告时间";
gc.FieldName = "AnnouncTime";
gc.Visible = true;
gc.VisibleIndex = 3;
this.gridView2.Columns.Add(gc);
gc = new GridColumn();
gc.Caption = "GUID编号";
gc.FieldName = "GUID";
gc.Visible = false;
this.gridView2.Columns.Add(gc);
////单元格内容左对齐
//DevExpress.XtraGrid.Columns.GridColumn col = gridView2.Columns[1];
DevExpress.XtraGrid.Columns.GridColumn col1 = gridView2.Columns[1];
//col.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
col1.AppearanceCell.TextOptions.HAlignment = HorzAlignment.Near;
}
catch (Exception ex)
{
log4net.ILog log = log4net.LogManager.GetLogger(this.GetType());
log.Debug("错误信息:方法(GridColumnBind)" + ex.Message.ToString());
}
}[/color][color=#ff0000][b]