高手请进,DRAWGRID问题,急等!!!!!!

高手请进,DRAWGRID问题,急等!!!!!! Delphi / Windows SDK/API
http://www.delphi2007.net/DelphiMultimedia/html/delphi_20061003171403270.html
有一个drawgrid控件,设置为5行5列,要在每个单元格中写入不同的数据(文本,要可以换行,每行文本可自定义,自定义颜色),如何实现?  
   
  谢谢!!!!

procedure   TForm1.DrawGrid1DrawCell(Sender:   TObject;   ACol,   ARow:   Integer;  
  Rect:   TRect;   State:   TGridDrawState);  
  var  
  bmp:   TBitmap;  
  begin  
   
  if   (ARow<>0)   then  
  begin  
  if   ACol=1   then//第一列画图  
  begin  
    bmp:=   TBitmap.Create;  
    bmp.LoadFromFile('c:\11.bmp');  
    DrawGrid1.Canvas.FillRect(Rect);  
    DrawGrid1.Canvas.CopyRect(Rect,bmp.Canvas,bmp.Canvas.ClipRect);  
    bmp.Free;  
  end;  
  if   acol=2   then   //第二列换行字符串  
  begin  
    DrawGrid1.Canvas.FillRect(Rect);  
    DrawText(DrawGrid1.Canvas.Handle,  
  pchar('字符串字符串字符串字符串字符串字符串字符串字符串'),  
  Length('字符串字符串字符串字符串字符串字符串字符串字符串'),  
  Rect,  
  DT_WORDBREAK   or   DT_CENTER);  
  end;  
  end;  
  end;

从delphi里拷贝过来怎么这个样子了?  
  ft,楼主在字符串换行的地方需要设置一下rowwidth

posted on 2009-03-13 10:26  delphi2007  阅读(342)  评论(0编辑  收藏  举报