DELPHI 画报表 画表头 stringgrid控件
2009-07-09 17:30
246 查看
DELPHI 画报表 画表头 stringgrid控件
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow:
Integer;
Rect: TRect; State: TGridDrawState);
var
i, x, y: Integer;
begin
If gdFixed In State Then Exit;
If ARow > 1 Then Exit;
// draw row 1 with text from cell 1,1 spanning all cells in the row
with sender as tstringgrid do begin
{extend rect to include grid line on right, if not last cell
in row}
If aCol < Pred(ColCount) Then
Rect.Right := Rect.Right + GridlineWidth;
{figure out where the text of the first cell would start relative
to the current cells rect. }
y:= Rect.Top + 2;
x:= Rect.Left + 2;
for i:= 1 to aCol-1 do
x:= x - ColWidths[i] - GridlineWidth;
{ Paint cell pale yellow}
Canvas.Brush.Color := $7FFFFF;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect( Rect );
{ Paint text of cell 1,1 clipped to current cell. }
Canvas.TextRect( Rect, x, y, Cells[1,1] );
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i, k: Integer;
begin
with stringgrid1 do begin
cells[1, 1] := 'A rather long line which will span cells';
for i:= 1 to colcount-1 do
for k:= 2 to rowcount -1 do
cells[i,k] := Format( 'Cell[%d,%d]',[i,k]);
end;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow:
Integer;
Rect: TRect; State: TGridDrawState);
var
i, x, y: Integer;
begin
If gdFixed In State Then Exit;
If ARow > 1 Then Exit;
// draw row 1 with text from cell 1,1 spanning all cells in the row
with sender as tstringgrid do begin
{extend rect to include grid line on right, if not last cell
in row}
If aCol < Pred(ColCount) Then
Rect.Right := Rect.Right + GridlineWidth;
{figure out where the text of the first cell would start relative
to the current cells rect. }
y:= Rect.Top + 2;
x:= Rect.Left + 2;
for i:= 1 to aCol-1 do
x:= x - ColWidths[i] - GridlineWidth;
{ Paint cell pale yellow}
Canvas.Brush.Color := $7FFFFF;
Canvas.Brush.Style := bsSolid;
Canvas.FillRect( Rect );
{ Paint text of cell 1,1 clipped to current cell. }
Canvas.TextRect( Rect, x, y, Cells[1,1] );
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i, k: Integer;
begin
with stringgrid1 do begin
cells[1, 1] := 'A rather long line which will span cells';
for i:= 1 to colcount-1 do
for k:= 2 to rowcount -1 do
cells[i,k] := Format( 'Cell[%d,%d]',[i,k]);
end;
end;
相关文章推荐
- DELPHI 画报表 画表头 stringgrid控件
- 三步轻松搞定delphi中CXGRID手动添加复表头(多行表头,报表头)
- 三步轻松搞定delphi中CXGRID手动添加复表头(多行表头,报表头)
- delphi StringGrid单击表头进行高速排序
- 在Delphi里这种格式的报表用FastReport实现起来方便呢还是用StringGrid实现起来方便呢?
- Delphi StringGrid常用属性和常用操作
- Delphi 生成网页(html)报表
- Delphi 将string 转为 Array of AnsiChar
- Delphi XE中String、ANSIString、TBytes之间的转换 一、string转为ansistring 1、直接赋值 (有警告) 2、ansistring()类型强制转换。(无警
- Delphi中定义为string的变量str头元素是str[0]还是str[1]?
- 冻结表头HTML报表制作方法
- [原创]ASP.NET MVC调用Delphi开发的Web报表打印activex组件
- 在Delphi里实现[int map string]对
- 【转】VS2010 RDLC报表 矩阵 详解 分组、总计、表头、显示方向、序号
- java报表实现excel一样冻结表头的功能
- 当前最全的TAdvStringGrid控件属性事件介绍和使用方法(AdvStringGrid使用技巧/Cells)
- Report Machine(RM)报表控件简单用法-delphi
- delphi中dll返回string问题
- Delphi中的THashedStringList对象
- delphi中pchar、char、string的定义与区别