怎么显示成这样?
我的意思:现在的grid的横线只有两种选择,要么全有,要么全不显示,我想知道能不能根据数据的情况分组显示,也就是隔几行在显示一个横线,当然间隔行不是一个确定的数,而应该根据数据而定!
我的意思:现在的grid的横线只有两种选择,要么全有,要么全不显示,我想知道能不能根据数据的情况分组显示,也就是隔几行在显示一个横线,当然间隔行不是一个确定的数,而应该根据数据而定!
解决方案 »
- Edit获得焦点后如何不进入编辑状态??
- Delphi中如何获得本地机上的所有网卡及它们的名称、IP设置等。
- 在WIN2000 下能否同时安装delphi5 和delphi6?
- 如何对数据库中指定的表备份以及表的几列备份啊?
- delphi中如何用函数播放mp3???谢谢
- 请所有在http://expert.csdn.net/Expert/topic/1360/1360834.xml?temp=.6661798上Mark过的同志们进来拿分!
- 急用!!!请问谁会使用API中的GetfileinformationByHandle这个函数?请帮忙!!!
- 高手帮忙:有两个应用程序1和应用程序2,其中程序1中有编辑框(EDIT1),程序2中也有编辑框(EDIT2),如何将EDIT2的内容传送给EDIT1?
- 浏览器
- 各位高手,请告诉我DELPHI,C++BUILDER该选哪一个?
- delphi能否象vc++那样,对系统的低层进行操作。delphi能否完成vc++的所有功能
- table中字段属性的运用问题
OndrawCell
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids;type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
case ARow of
3,5,10:begin
With StringGrid1 do begin
if Cells[ACol,Arow]<>'' then begin
Canvas.MoveTo (Rect.left,Rect.Top);
Canvas.LineTo (rect.right,rect.top);
end;
end;
end;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
begin
With StringGrid1 do begin
for i:=0 to 17 do begin
RowCount:=RowCount+1;
Cells[0,i]:=inttostr(i);
end;
end;
end;end.
要TDRAWGRID中有几个函数可能有用:
function CellRect(ACol, ARow: Longint): TRect;
procedure MouseToCell(X, Y: Integer; var ACol, ARow: Longint);
在获取单元的坐标后,就可应用CANVAS任意作图了。
不过先把分分了,椅子鼓励 :-)