StringGrid 如何控制某一列的字体大小??!!!!!!

解决方案 »

  1.   


    参考这个吧你的要求和这个差不多procedure TEmergiForm.emergidataDrawCell(Sender: TObject; Col,
      Row: Integer; Rect: TRect; State: TGridDrawState);
    var count, r: integer;
    begin
       r := row;  // Copy variable 'row' as it only  seems to be valid for a short time
       Count :=  (Row - 1) * emergidata.colcount + Col;
       if (count > 0) and (count <= list.count) then
       with (sender as tstringgrid) do
       begin
          if state = [] then  // dont overwrite fixed areas
            begin
               if R  = Foundrow then
                   canvas.brush.color := FindColour
               else
                  begin
                     if pos('*',list.strings[count]) <> 0 then
                     //if pos('fault',list.strings[count]) <> 0 then                     begin
                       //     canvas.brush.color := (objects[0, R] as TCellcol).colour;                        canvas.brush.color := ErrorColour;//clRed;
                            canvas.font.color := clwhite;
                         end
                     else
                         begin
                            canvas.brush.color := OKColour;//clwindow;
                         end;
                  end;
              canvas.fillrect(rect);
              canvas.textout(rect.left + 2, rect.top + 2,list.strings[count]);
           end;
      end;