高手请进,DRAWGRID问题,急等!!!!!!
有一个drawgrid控件,设置为5行5列,要在每个单元格中写入不同的数据(文本,要可以换行,每行文本可自定义,自定义颜色),如何实现?
谢谢!!!!
问题点数:20、回复次数:2Top
1 楼happyggy(Delphi<-&&->java)回复于 2006-11-08 11:40:12 得分 20
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;Top
2 楼happyggy(Delphi<-&&->java)回复于 2006-11-08 11:41:49 得分 0
从delphi里拷贝过来怎么这个样子了?
ft,楼主在字符串换行的地方需要设置一下rowwidthTop




