Ehlib表格区填满表格线的解决方案

<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/46860.html" frameborder="0" width="468" scrolling="no" height="60"></iframe>

表格区填满表格线的问题,公布如下:

3。6版本中修改DBGridEh.pas单元的UpdateRowCount过程:
procedure TCustomDBGridEh.UpdateRowCount;
var BetweenRowHeight, t: Integer;
OldRowCount, OccupiedHeight, VisibleDataRowCount, NewRowCount: Integer;
。。。。。。。。。。。。。。
begin
...............................
with FDataLink do
if not Active or (RecordCount = 0) or not HandleAllocated then
begin
.................
end else
begin
VisibleDataRowCount := (ClientHeight - OccupiedHeight {- LineHeight}) div DefaultLineRowHeight;
if VisibleDataRowCount

FDataLink.BufferCount := VisibleDataRowCount;
if FFooterRowCount = 0 then //增加的一个条件,用户可以用FooterRowCount值来决定是否填满表格线
VisibleDataRowCount := FDataLink.RecordCount;
Inc(OccupiedHeight, DefaultLineRowHeight * VisibleDataRowCount);
NewRowCount := VisibleDataRowCount + TopDataOffset;

if FooterRowCount > 0 then
begin
NewRowCount := NewRowCount + FooterRowCount + 1;
SetRowCount(NewRowCount);
BetweenRowHeight := ClientHeight - OccupiedHeight {- LineHeight};
if BetweenRowHeight //RowHeights[TopDataOffset + VisibleDataRowCount] := BetweenRowHeight;//原代码行
RowHeights[TopDataOffset + VisibleDataRowCount] := 0;//修改后的代码行
//把多余的不足一行的高度加在最后一行,增加下面一行代码
RowHeights[FTitleOffset + VisibleDataRowCount] := DefaultRowHeight+BetweenRowHeight;
end else
SetRowCount(NewRowCount);

UpdateActive;
end;
if OldRowCount RowCount then Invalidate;
end;


4.14版本中也是修改DBGridEh.pas单元的UpdateRowCount过程:
procedure TCustomDBGridEh.UpdateRowCount;
var
BetweenRowHeight,{恢复被注释掉的变量BetweenRowHeight} t: Integer;
OldRowCount, OccupiedHeight, VisibleDataRowCount, NewRowCount: Integer;
。。。。。。。。。。。。。
begin
...........................
with FDataLink do
if not Active or (RecordCount = 0) or not HandleAllocated then
begin
//MoveColRow(Col, TitleOffset, False, False);

SetRowCount(1 + TopDataOffset);
ContraRowCount := FooterRowCount;
//恢复原代码中被注释掉的语句行
(*========================================================================*)
SetRowCount(1 + TopDataOffset);
Inc(OccupiedHeight, DefaultLineRowHeight);
if HandleAllocated then
begin
if (FooterRowCount > 0) then
begin
SetRowCount(RowCount + FooterRowCount + 1);
BetweenRowHeight := ClientHeight - OccupiedHeight {- LineHeight};
if BetweenRowHeight RowHeights[TopDataOffset + 1] := BetweenRowHeight;
end;
end;
(*========================================================================*)
end else
begin
VisibleDataRowCount := (ClientHeight - OccupiedHeight {- LineHeight}) div DefaultLineRowHeight;
if VisibleDataRowCount

FDataLink.BufferCount := VisibleDataRowCount;
if FFooterRowCount = 0 then //增加的一个条件,用户可以用FooterRowCount值来决定是否填满表格线
VisibleDataRowCount := FDataLink.RecordCount;
Inc(OccupiedHeight, DefaultLineRowHeight * VisibleDataRowCount);
NewRowCount := VisibleDataRowCount + TopDataOffset;

if FooterRowCount > 0 then
begin
SetRowCount(NewRowCount);
ContraRowCount := FooterRowCount;
//恢复原代码中注释掉的部分
(*========================================================================*)
NewRowCount := NewRowCount + FooterRowCount + 1;
SetRowCount(NewRowCount);
BetweenRowHeight := ClientHeight - OccupiedHeight {- LineHeight};
if BetweenRowHeight //RowHeights[TopDataOffset + VisibleDataRowCount] := BetweenRowHeight;//这一行仍然不要,改成下面的代码
(*========================================================================*)
RowHeights[TopDataOffset + VisibleDataRowCount] := 0;//修改后的代码行
//把多余的不足一行的高度加在最后一行,增加下面一行代码
RowHeights[FTitleOffset + VisibleDataRowCount] := DefaultRowHeight+BetweenRowHeight;
end else
SetRowCount(NewRowCount);

UpdateActive;
end;
if OldRowCount RowCount then Invalidate;
end;



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1620235


你可能感兴趣的:(html,.net,Blog)