AdvStringGrid用法

AdvStringGrid

//从文件中加载
asg.LoadFromCSV(Path+FileName);

//清空所有行
asg.ClearRows(0,asg.RowCount-1);

//保存
asg.SaveToCSV(Path+'Test.csv');

ColCount := 41;         {总列数}

RowCount := 3;          {总行数}

FixedRows := 2;           {表头行数}

FixedCols := 2;           {表头列数}

    DefaultColWidth := 18;    {设缺省列宽}
    DefaultRowHeight := 18;   {设缺省行高}
    ColWidths[0] := 56;       {设表头第一列宽}

    RowHeights[0] := 20;      {设表头第一行高}

    MergeCells(0,0,1,2); {合并函数:列,行,合并多少列,合并多少行}

    Cells[0,0] := '期数'; {显示文字}

  {对符合条件的列行着背景色和文字色、类型}//OnGetCellColor事件
  if (not(aRow In [0..1])) and (aCol In [2..11]) then  
  begin
    AFont.Style := AFont.Style + [fsBold];
    ABrush.Color := $00E0FFFA;
    AFont.Color := clWhite;
  end;

Halign := taCenter; {文字水平垂直居中}//OnGetAlignment事件

原文地址:https://www.cnblogs.com/hnxxcxg/p/2940852.html