由于要计算平均分我用TStringGrid显示数据库中学生成绩表的内容,如何让成绩在60分以下的记录显示为红色。

解决方案 »

  1.   

    i, j: Integer;for i := 0 to StringGrid.Col do
      for j := 0 to StringGrid.Row do
        if StrToInt(StringGrid.Cell(j, i)) > 60 then
          ...(這裡是搞不定的,不支持著色操作)
      

  2.   

    StringGrid1->Canvas->Brush->Color=clYellow;
              StringGrid1->Canvas->FillRect(Rect);
              //if you want set font color , insert it here
              DrawText(StringGrid1->Canvas->Handle,
              StringGrid1->Cells[ACol][ARow].c_str(),
              -1,(RECT*)&Rect,
              DT_SINGLELINE | DT_VCENTER |DT_CENTER
      

  3.   

    烤, 又一个drawCell搞定的