TDrawGrid控件问题,急等!!!!!!! 有一个drawgrid控件,设置为5行5列,要在每个单元格中写入不同的数据(文本,要可以换行,每行文本可自定义,自定义颜色),如何实现?谢谢!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure Tfm_main.GetTWInfo; var outputTW: TRect; RowCount, RecNo, ColNo, RowNo, twstate: Integer; twname: string; DIVNUM, MODNUM: Integer;begin if OpenSQL(adoqry_tw, 'select A.*,B.name as bm_name ,c.name as type_name from tw_info A,tw_bm B,tw_type C where A.twbm=b.id and A.tw_type=c.id order by a.code') = True then begin twRow := adoqry_tw.RecordCount; RowCount := twRow div drwgrd_tw.ColCount; drwgrd_tw.RowCount := RowCount + 1; end; adoqry_tw.First; while not adoqry_tw.Eof do begin RecNo := adoqry_tw.RecNo; DIVNUM := RecNo div drwgrd_tw.ColCount; //行号 MODNUM := RecNo mod drwgrd_tw.ColCount; //列号 ColNo := 0; RowNo := 0; if RecNo <= drwgrd_tw.ColCount then begin ColNo := 0; RowNo := RecNo - 1; end; if (DIVNUM >= 1) and (RecNo > drwgrd_tw.ColCount) and (MODNUM = 0) then begin ColNo := DIVNUM - 1; RowNo := drwgrd_tw.ColCount - 1; end; if (DIVNUM >= 1) and (RecNo > drwgrd_tw.ColCount) and (MODNUM <> 0) then begin ColNo := DIVNUM; RowNo := MODNUM - 1; end; outputTW := drwgrd_tw.CellRect(RowNo, ColNo); twname := Trim(adoqry_tw.FieldByName('name').AsString); twstate := adoqry_tw.FieldByName('tw_state').AsInteger; drwgrd_tw.Canvas.Brush.Color := clWhite; drwgrd_tw.Canvas.Font.Color := clBlack; if twstate = 2 then //使用 begin drwgrd_tw.Canvas.Brush.Color := clLime; end; if twstate = 3 then //预定 begin drwgrd_tw.Canvas.Brush.Color := clActiveCaption; drwgrd_tw.Canvas.Font.Color := clWindow; end; if twstate = 4 then //禁用 begin drwgrd_tw.Canvas.Brush.Color := clYellow; end; drwgrd_tw.Canvas.TextRect(outputTW, outputtw.Left + 2, outputtw.Top + 2, twname); drwgrd_tw.Canvas.TextOut(outputtw.Left + 1, outputtw.Top + 20, Trim(adoqry_tw.FieldByName('type_name').AsString)); adoqry_tw.Next; end;end; 自由界面和报表的完美解决方案。http://www.anylib.com 求skinpack第三方控件中各组件的用法详解(满意分77) 如何实现半透明的并且是柔和的那种阴影效果? 急问如何建一个数据库,只要把数据库文件拷到其它电脑里就能运行,不用过多的配置 请教一个调用C++生成的DLL函数时遇到的问题! 高手进 怎样编程实现利用insert语句向oracle里导入数据? 高分求控件 怎样将real转换为int? 请问:哪里有fastreport的使用教程,它自带的实在是看不懂。或者给个例子也行 Delphi6安装Rxlib2.75 for d6后出错 帮助:读取文件名出错 delphi怎么读出网络上的记事本文件中的内容
var
outputTW: TRect;
RowCount, RecNo, ColNo, RowNo, twstate: Integer;
twname: string;
DIVNUM, MODNUM: Integer;
begin
if OpenSQL(adoqry_tw,
'select A.*,B.name as bm_name ,c.name as type_name from tw_info A,tw_bm B,tw_type C where A.twbm=b.id and A.tw_type=c.id order by a.code') =
True then
begin
twRow := adoqry_tw.RecordCount;
RowCount := twRow div drwgrd_tw.ColCount;
drwgrd_tw.RowCount := RowCount + 1;
end;
adoqry_tw.First;
while not adoqry_tw.Eof do
begin
RecNo := adoqry_tw.RecNo;
DIVNUM := RecNo div drwgrd_tw.ColCount; //行号
MODNUM := RecNo mod drwgrd_tw.ColCount; //列号
ColNo := 0;
RowNo := 0;
if RecNo <= drwgrd_tw.ColCount then
begin
ColNo := 0;
RowNo := RecNo - 1;
end;
if (DIVNUM >= 1) and (RecNo > drwgrd_tw.ColCount) and (MODNUM = 0) then
begin
ColNo := DIVNUM - 1;
RowNo := drwgrd_tw.ColCount - 1;
end;
if (DIVNUM >= 1) and (RecNo > drwgrd_tw.ColCount) and (MODNUM <> 0) then
begin
ColNo := DIVNUM;
RowNo := MODNUM - 1;
end;
outputTW := drwgrd_tw.CellRect(RowNo, ColNo);
twname := Trim(adoqry_tw.FieldByName('name').AsString);
twstate := adoqry_tw.FieldByName('tw_state').AsInteger;
drwgrd_tw.Canvas.Brush.Color := clWhite;
drwgrd_tw.Canvas.Font.Color := clBlack;
if twstate = 2 then //使用
begin
drwgrd_tw.Canvas.Brush.Color := clLime;
end;
if twstate = 3 then //预定
begin
drwgrd_tw.Canvas.Brush.Color := clActiveCaption;
drwgrd_tw.Canvas.Font.Color := clWindow;
end;
if twstate = 4 then //禁用
begin
drwgrd_tw.Canvas.Brush.Color := clYellow;
end;
drwgrd_tw.Canvas.TextRect(outputTW, outputtw.Left + 2, outputtw.Top + 2, twname);
drwgrd_tw.Canvas.TextOut(outputtw.Left + 1, outputtw.Top + 20,
Trim(adoqry_tw.FieldByName('type_name').AsString));
adoqry_tw.Next;
end;
end;
http://www.anylib.com