TDBGridEh 4.14 怎么样改源代码,使它能当有空行时,列的左右两边的坚线能一直画到Grid底部。(100分)

  • 主题发起人 主题发起人 GalfordLiu
  • 开始时间 开始时间
G

GalfordLiu

Unregistered / Unconfirmed
GUEST, unregistred user!
在以前的旧版(好像是3.6)TDBGridEh中,当行数不足填满整个Grid时,列左右的坚线会一直画到Grid的底部。这种效果在有Footer时十分有用。可是4.14版的Grid,只画有效行,空行并没有画出坚线。怎么样写源代码,使当行为空时,列左右的坚线仍然能画到底?我找了很久,能力有限,改不了,请各位指教。
 
这个很那难做,不知道DBGridEh怎样,应该什么版本都没有出现过这种功能。

我只知道DBGrid的空白区是在TCustomGrid的Paint过程里面给填上白色的,
在Grids.pas的TCustomGrid.Paint过程里面,你会找到这段

{ Fill in area not occupied by cells }
if Horz.GridBoundary < Horz.GridExtent then
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(Rect(Horz.GridBoundary, 0, Horz.GridExtent, Vert.GridBoundary));
end;
if Vert.GridBoundary < Vert.GridExtent then
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(Rect(0, Vert.GridBoundary, Horz.GridExtent, Vert.GridExtent));
end;

这是填充空白区的,你可以改掉它,自己画空白区,但很麻烦,因为这时候已经将
所有格子画完,要自己重新计算每一列的位置。我自制的表格可以将空白区画上格
子,方法更复杂,要做很多计算,不能简单套用到其它表格上 kinneng.icpcn.com
 
哦.这样吗? 谢谢了. 我以前用过一个版本,提供了这种功能,可能是发布的人自己写的吧.我去找下源代码看看.
 
帮顶.........................
 
加了FOOT好象它就可以一直画到底了,不加就不会画呢
 
加了Footer它也不画.我用的是最新的3.5版.晕死啊.弄不出来.
 
对,我也想画到底,
 
没人回答了吗? 高手们
 
下载我自用的表格,断开数据一样画满格子,还有其它强劲功能,比dbgrideh有过之而没不及,又不用交费,eh要正版交费,我自己用的。http://kinneng.icpcn.com
 
不用改源代码,将rootcount行设置为可视就行了。
 
要增加这样的效果,
增加一个showFullLines属性
然后修改:
GridEh..pas中的
procedure TCustomGridEh.Paint;中的
{ Draw the grid line in the four areas (fixed, fixed), (variable, fixed),
(fixed, variable) and (variable, variable) }

最近想修改ehlib4.14,看哪个兄弟先动手啊
 
回thinknet: 没有这个属性吧? 只指FooterRowCount吗? 设置了,没有用

回flysand: 是把里面的注释的代码改一下吧? 我改了,去了注释,重新生成控件后,然而还是没有这个效果
是改这些吗?
PointsList := StackAlloc(MaxStroke * sizeof(TPoint) * 2);//
StrokeList := StackAlloc(MaxStroke * sizeof(Integer));//

[:(]
 
搞了几天,才发现关键是修改TCustomDBGridEh.DrawCell过程才是正解!
哪位朋友有兴趣改4.14?
以下是ehlib3.2经过SHJ、PGT修改后,我再修改的最终版本
示例图:http://www.flysand.com/ehlib32.gif
TCustomDBGridEh.DrawCell
.
.
.
begin
//shj Add
CurrRect:=Rect(ARect.Left,ARect.Bottom-CurrencyStyle.CHNHeight,
ARect.Right,ARect.Bottom);
NeedPaintHead:=False;
//shj End

If FShowBmp And (dgindicator in Options) Then
Canvas.Draw(2,2, F_MenuBMP); // Add By Pgt
CellMultiSelected := False;
FColCellParamsEh.FCol := ACol;
FColCellParamsEh.FRow := ARow;
ADrawCellRect := ARect;
Highlight := False;
if (ARect.Left >= ARect.Right) then Exit;
DrawColumn := nil;
Down := False;
if csLoading in ComponentState then
begin
Canvas.Brush.Color := Color;
Canvas.FillRect(ARect);
Exit;
end;

The3DRect := CellHave3DRect(ACol, ARow, ARect, AState);

CellType := GetCellType(ACol, ARow, DataCol, DataRow);
Dec(ARow, TopDataOffset);
Dec(ACol, IndicatorOffset);

if The3DRect then
begin
InflateRect(ARect, -1, -1);
XFrameOffs := 1;
end else
XFrameOffs := 2;
YFrameOffs := XFrameOffs;

if Flat then Dec(YFrameOffs);

if (gdFixed in AState) and (ACol < 0) then // Indicator col
begin
if ((FooterRowCount = 0) or ((FooterRowCount > 0) and
(ARow <> RowCount - FooterRowCount - 1 - TopDataOffset))) or (dghFrozen3D in OptionsEh)
then Canvas.Brush.Color := FixedColor
else Canvas.Brush.Color := Color;
// Canvas.FillRect(ARect);
if Assigned(DataLink) and DataLink.Active then
begin
MultiSelected := (Selection.SelectionType = gstAll);
if (ARow >= 0) and ((ARow < FDatalink.RecordCount) or (FooterRowCount = 0)) then // Indicator
begin
// OldActive := FDataLink.ActiveRecord;
InstantReadRecordEnter(ARow);
try
// FDatalink.ActiveRecord := ARow;
MultiSelected := RowIsMultiselected;
finally
// FDatalink.ActiveRecord := OldActive;
InstantReadRecordLeave;
end;
end;
if MultiSelected then
begin
BackColor := Canvas.Brush.Color;
Highlight := HighlightNoDataCellColor(ACol + IndicatorOffset, ARow + TopDataOffset,
DataCol, DataRow, CellType, AState, MultiSelected, BackColor, Canvas.Font);
Canvas.Brush.Color := BackColor;
end;
Canvas.FillRect(ARect);
if IsCurrentRow(ARow) or MultiSelected then
begin
Indicator := -1;
//FIndicators.BkColor := FixedColor; //??? to avoid ImageListChange event
if FDataLink.DataSet <> nil then
case FDataLink.DataSet.State of
dsEdit: Indicator := 1;
dsInsert: Indicator := 2;
dsBrowse:
if IsCurrentRow(ARow) then
if MultiSelected then
Indicator := 5
else if FInplaceSearching then
Indicator := 6
else
Indicator := 0;
else Indicator := 0; // multiselected and current row
end;
DBGridEhIndicators.Draw(Canvas, ARect.Right - DBGridEhIndicators.Width - XFrameOffs,
(ARect.Top + ARect.Bottom - DBGridEhIndicators.Height) shr 1, Indicator);
if ARow = FDatalink.ActiveRecord then
FSelRow := ARow + TopDataOffset;
end;
end
else Canvas.FillRect(ARect);
end
else with Canvas do
begin
DrawColumn := Columns[ACol];
if (gdFixed in AState) and ((ACol < 0) or (ARow < 0)) then
begin
Font := DrawColumn.Title.Font;
Brush.Color := DrawColumn.Title.Color;
end
else
begin
Font := DrawColumn.Font;
Brush.Color := DrawColumn.Color;
end;
if (ARow < 0) and (ARow = -TopDataOffset) and (dgTitles in Options)
then with DrawColumn.Title do // draw headline
begin
// new --
Down := (FPressedCol - IndicatorOffset = ACol) and FPressed;
ImageWidth := 0;
if (FUseMultiTitle = True) then
begin
ARect.Top := ARect.Bottom - FLeafFieldArr[ACol].FLeaf.Height + 3;
TitleText := FLeafFieldArr[ACol].FLeaf.Text;
end else
TitleText := Caption;
if (TitleImages <> nil) and (ImageIndex <> -1) then
begin
TitleText := '';
ImageWidth := TitleImages.Width;
end;
ARect1 := ARect;
ASortMarker := DrawColumn.Title.SortMarker;
if (DrawColumn.Field <> nil) and Assigned(FOnGetBtnParams) then
begin
BackColor := Canvas.Brush.Color;
FOnGetBtnParams(Self, DrawColumn, Canvas.Font, BackColor, ASortMarker, Down);
Canvas.Brush.Color := BackColor;
end;
if Down then
begin
if (FUseMultiTitle = True) or (TitleHeight <> 0) or (TitleLines <> 0) then
begin
LeftMarg := 2; RightMarg := -2; Inc(ARect1.Top, 2);
end else
begin
LeftMarg := 1; RightMarg := -1; Inc(ARect1.Top, 1);
end;
end else
begin
LeftMarg := 0;
RightMarg := 0;
end;
case ASortMarker of
smDownEh: SortMarkerIdx := 0;
smUpEh: SortMarkerIdx := 1;
else SortMarkerIdx := -1;
end;
SMTMarg := 0; SMImageFit := True;
if SortMarkerIdx <> -1 then
begin
Dec(ARect1.Right, 16);
if (SortMarkedColumns.Count > 1) then
begin
Canvas.Font := SortMarkerFont;
SMTMarg := Canvas.TextWidth(IntToStr(SortIndex));
end else
SMTMarg := 0;
if ARect1.Right < ARect1.Left + ImageWidth then
begin
ARect1.Right := ARect1.Right + 14 - SMTMarg;
SMImageFit := False;
end;
if ARect1.Right < ARect1.Left + ImageWidth then
begin
ARect1.Right := ARect1.Right + 2 + SMTMarg;
SMTMarg := 0;
end;
end;
{if FUseMultiTitle = True then Canvas.Font := TitleFont else} Canvas.Font := Font;
if (DrawColumn.Field <> nil) and Assigned(FOnGetBtnParams) then // To resotre changed in FOnGetBtnParams font
FOnGetBtnParams(Self, DrawColumn, Canvas.Font, BackColor, ASortMarker, Down);

CellMultiSelected := CellIsMultiSelected(ACol + IndicatorOffset, ARow + TopDataOffset, DataCol, '');
BackColor := Canvas.Brush.Color;
Highlight := HighlightNoDataCellColor(ACol + IndicatorOffset, ARow + TopDataOffset,
DataCol, DataRow, CellType, AState, CellMultiSelected, BackColor, Canvas.Font);
Canvas.Brush.Color := BackColor;

Canvas.FillRect(Rect(ARect1.Right, ARect.Top, ARect.Right, ARect.Bottom));
//shj add
CurrTitleRect:=Rect(ARect1.Left,ARect1.top,ARect1.Right,ARect1.Bottom-CurrencyStyle.CHNHeight+1);
//shj end
if (FUseMultiTitle = True) then
begin
//Canvas.Font := TitleFont;
if Orientation = tohVertical then
//shj add
if DrawCurrency and DrawColumn.IsCurrency and FNeedPaintCurrHead then
begin
Canvas.Font.Height:=CurrTitleRect.Bottom-CurrTitleRect.top;
WriteTextVerticalEh(Canvas, CurrTitleRect, False, XFrameOffs, YFrameOffs + 2,
TitleText, taCenter, tlBottom, EndEllipsis, False)
end
else
begin
WriteTextVerticalEh(Canvas, ARect1, False, XFrameOffs, YFrameOffs + 2,
TitleText, taCenter, tlBottom, EndEllipsis, False);
end
//shj end
{ original WriteTextVerticalEh(Canvas, ARect1, False, XFrameOffs, YFrameOffs + 2,
TitleText, taCenter, tlBottom, EndEllipsis, False)
}
else
//shj add
if DrawCurrency and DrawColumn.IsCurrency and FNeedPaintCurrHead then
begin
if (CurrTitleRect.Bottom-CurrTitleRect.Top)>(Canvas.Font.Size*1.5) then
WriteCellText {WriteTextEh}(Canvas, CurrTitleRect, False, XFrameOffs, YFrameOffs, TitleText,
taCenter, tlCenter, True, EndEllipsis, LeftMarg, RightMarg)
else
WriteCellText {WriteTextEh}(Canvas, CurrTitleRect, False, XFrameOffs, YFrameOffs, TitleText,
taCenter, tlBottom, True, EndEllipsis, LeftMarg, RightMarg);
end
else
begin
WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
taCenter, tlCenter, True, EndEllipsis, LeftMarg, RightMarg);
end;
//original WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
// taCenter, tlCenter, True, EndEllipsis, LeftMarg, RightMarg);

//Canvas.Pen.Color := clWindowFrame;
end
else if (TitleHeight <> 0) or (TitleLines <> 0) then
begin
if Orientation = tohVertical then
//shj add
if DrawCurrency and DrawColumn.IsCurrency and FNeedPaintCurrHead then
begin
Canvas.Font.Size:=Canvas.Font.Size-2;
WriteTextVerticalEh(Canvas, CurrTitleRect, False, XFrameOffs, YFrameOffs + 2,
TitleText, Alignment, tlBottom, EndEllipsis, False);
end
else
begin
WriteTextVerticalEh(Canvas, ARect1, False, XFrameOffs, YFrameOffs + 2,
TitleText, Alignment, tlBottom, EndEllipsis, False);
end
//shj end
{original WriteTextVerticalEh(Canvas, ARect1, False, XFrameOffs, YFrameOffs + 2,
TitleText, Alignment, tlBottom, EndEllipsis, False)
}
else
//shj add
if DrawCurrency and DrawColumn.IsCurrency and FNeedPaintCurrHead then
begin
Canvas.Font.Height:=CurrTitleRect.Bottom-CurrTitleRect.top;
WriteCellText {WriteTextEh}(Canvas, CurrTitleRect, False, XFrameOffs, YFrameOffs, TitleText,
Alignment, tlCenter, True, EndEllipsis, LeftMarg, RightMarg);
end
else
begin
WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
Alignment, tlCenter, True, EndEllipsis, LeftMarg, RightMarg);
end;
//shj end
//original WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
// Alignment, tlCenter, True, EndEllipsis, LeftMarg, RightMarg)
end else
begin
ARect1.Left := ARect1.Left + LeftMarg;
ARect1.Right := ARect1.Right - RightMarg;

//shj add
CurrTitleRect:=Rect(ARect1.Left,ARect1.top,ARect1.Right,ARect1.Bottom-CurrencyStyle.CHNHeight+1);
//shj end

if Orientation = tohVertical then
//shj add
if DrawCurrency and DrawColumn.IsCurrency and FNeedPaintCurrHead then
begin
WriteTextVerticalEh(Canvas, CurrTitleRect, False, XFrameOffs, YFrameOffs + 2,
TitleText, Alignment, tlBottom, EndEllipsis, False);
end
else
begin
WriteTextVerticalEh(Canvas, ARect1, False, XFrameOffs, YFrameOffs + 2,
TitleText, Alignment, tlBottom, EndEllipsis, False);
end
//shj end
{original WriteTextVerticalEh(Canvas, ARect1, False, XFrameOffs, YFrameOffs + 2,
TitleText, Alignment, tlBottom, EndEllipsis, False)
}
else
//shj add
if DrawCurrency and DrawColumn.IsCurrency and FNeedPaintCurrHead then
begin
Canvas.Font.Height:=CurrTitleRect.Bottom-CurrTitleRect.top;
WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
Alignment, tlTop, False, EndEllipsis, LeftMarg, RightMarg);
end
else
begin
WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
Alignment, tlTop, False, EndEllipsis, LeftMarg, RightMarg);
end;
// WriteCellText {WriteTextEh}(Canvas, ARect1, False, XFrameOffs, YFrameOffs, TitleText,
// Alignment, tlTop, False, EndEllipsis, LeftMarg, RightMarg);
end;
if (TitleImages <> nil) and (ImageIndex <> -1) then
begin
with TitleImages do
begin
//BkColor := Canvas.Brush.Color; //??? to avoid ImageListChange event
// Draw(Canvas, (ARect1.Right + ARect1.Left - Width) div 2 + LeftMarg,
// (ARect1.Bottom + ARect1.Top - Height) div 2, ImageIndex);
if FUseMultiTitle
then DrawClipped(TitleImages, nil, Canvas, ARect1, ImageIndex, LeftMarg, taCenter)
else DrawClipped(TitleImages, nil, Canvas, ARect1, ImageIndex, LeftMarg, Alignment);
end;
end;
if SortMarkerIdx <> -1 then
begin
if SMImageFit <> False then
begin
//FSortMarkerImages.BkColor := Canvas.Brush.Color; //??? to avoid ImageListChange event
DBGridEhSortMarkerImages.Draw(Canvas, ARect.Right - DBGridEhSortMarkerImages.Width - 2 - SMTMarg + LeftMarg,
(ARect.Bottom + ARect.Top - DBGridEhSortMarkerImages.Height) div 2 + LeftMarg, SortMarkerIdx);
end;
if SMTMarg <> 0 then
begin
Canvas.Font := SortMarkerFont;
if Highlight = True
then Canvas.Font.Color := clWhite;
Canvas.TextOut(ARect.Right - SMTMarg - 2 + LeftMarg,
(ARect.Bottom + ARect.Top - DBGridEhSortMarkerImages.Height) div 2 + LeftMarg - 1,
IntToStr(SortIndex));
Canvas.Font := TitleFont;
if Highlight = True
then Canvas.Font.Color := clWhite;
end;
end;
//shj add draw currency headline
NeedPaintHead:= DrawCurrency and FNeedPaintCurrHead and(DrawColumn.IsCurrency);
if NeedPaintHead then begin //fs add
CurrencyStyle.PaintHead(Self.Canvas,CurrRect,FFixGridLineColor); //fs add
end;
//shj end
end
////
else if (ARow < 0) then
DrawSubTitleCell(FColCellParamsEh.FCol, FColCellParamsEh.FRow,
DataCol, DataRow, CellType, ADrawCellRect, AState, Highlight)
else if (DataLink = nil) or not DataLink.Active
then FillRect(ARect)
else
begin // Draw contents
Value := '';
if ((ARow >= 0) and (ARow < FDatalink.RecordCount)) or (FooterRowCount = 0) then
begin
//OldActive := DataLink.ActiveRecord;
InstantReadRecordEnter(ARow);
try
//DataLink.ActiveRecord := ARow;

AEditStyle := esSimple;
if Flat then AEditLineWidth := 1 else AEditLineWidth := 0;
AButtonsWidth := 0;
ACellRect := ARect;
if (DrawColumn.AlwaysShowEditButton) then // Draw edit button
begin
AEditStyle := GetColumnEditStile(DrawColumn);
AButtonsWidth := DrawColumn.EditButtonsWidth;
ARect.Right := ARect.Right - AButtonsWidth;
end;

//original Value := DrawColumn.DisplayText;
//shj add
if ARow < FDatalink.RecordCount then
Value := DrawColumn.DisplayText;
if (DrawColumn.IsCurrency) and (FHasCurrency) and (ARow < FDatalink.RecordCount) then
Value := CurrToStrF(DrawColumn.Field.AsCurrency,
ffFixed,CurrencyStyle.Digits);
//shj end

FColCellParamsEh.FState := AState;
FColCellParamsEh.FFont := Font;
FColCellParamsEh.FAlignment := DrawColumn.Alignment;
FColCellParamsEh.FBackground := Canvas.Brush.Color;
FColCellParamsEh.FText := Value;
if DefaultDrawing then
//shj add
if DrawColumn.IsCurrency and DrawCurrency and FNeedPaintCurrHead then //shj Add金额线
begin FCurrencyStyle.PaintBody(Self.Canvas,Value,ARect);NeedPaintHead:=false;end else
//shj end

if DrawColumn.GetColumnType = ctKeyImageList then
begin
FColCellParamsEh.FImageIndex := DrawColumn.KeyList.IndexOf(DrawColumn.Field.Text);
if FColCellParamsEh.FImageIndex = -1 then FColCellParamsEh.FImageIndex := DrawColumn.NotInKeyListIndex;
end else if DrawColumn.GetColumnType = ctCheckboxes
then FColCellParamsEh.FCheckboxState := DrawColumn.CheckboxState;

GetCellParams(DrawColumn, Font, FColCellParamsEh.FBackground, AState);
DrawColumn.GetColCellParams(False, FColCellParamsEh);

Highlight := HighlightDataCellColor(ACol, ARow, Value, AState, FColCellParamsEh.FBackground, Font);
if Highlight then
AState := AState + [gdSelected];

Canvas.Brush.Color := FColCellParamsEh.FBackground;

if DefaultDrawing and (ARect.Right > ARect.Left) then
//shj add
if DrawColumn.IsCurrency and DrawCurrency then //shj Add金额线
begin FCurrencyStyle.PaintBody(Self.Canvas,Value,ARect);NeedPaintHead:=false;end else
//shj end
if DrawColumn.GetColumnType in [ctCommon..ctKeyPickList] then
with FColCellParamsEh do
WriteCellText {WriteTextEh}(Canvas, ARect, True, XFrameOffs, YFrameOffs, FText,
FAlignment, tlTop, DrawColumn.WordWrap and FAllowWordWrap, DrawColumn.EndEllipsis, 0, 0)
else if DrawColumn.GetColumnType = ctKeyImageList then
begin
FillRect(ARect);
DrawClipped(DrawColumn.ImageList, nil, Canvas, ARect, FColCellParamsEh.FImageIndex, 0, taCenter);
end else if DrawColumn.GetColumnType = ctCheckboxes then
begin
FillRect(ARect);
ARect1.Left := ARect.Left + iif(ARect.Right - ARect.Left < DefaultCheckBoxWidth, 0,
(ARect.Right - ARect.Left) shr 1 - DefaultCheckBoxWidth shr 1);
ARect1.Right := iif(ARect.Right - ARect.Left < DefaultCheckBoxWidth, ARect.Right,
ARect1.Left + DefaultCheckBoxWidth);
ARect1.Top := ARect.Top + iif(ARect.Bottom - ARect.Top < DefaultCheckBoxHeight, 0,
(ARect.Bottom - ARect.Top) shr 1 - DefaultCheckBoxHeight shr 1);
ARect1.Bottom := iif(ARect.Bottom - ARect.Top < DefaultCheckBoxHeight, ARect.Bottom,
ARect1.Top + DefaultCheckBoxHeight);
PaintButtonControl {Eh}(Canvas.Handle, ARect1, Canvas.Brush.Color, bcsCheckboxEh,
0, Flat, False, True, FColCellParamsEh.FCheckboxState);
end;

if DrawColumn.AlwaysShowEditButton then // Draw edit button
begin
SetRect(ARect1, ARect.Right, ARect.Top,
ARect.Right + FInplaceEditorButtonWidth, ARect.Top + FInplaceEditorButtonHeight);
if (AEditStyle <> esSimple) then
begin
if The3DRect then OffsetRect(ARect1, 1, -1); // InflateRect(ARect1, -1, -1);
{if AEditStyle = esUpDown then
Canvas.Draw(ARect1.Left,ARect1.Top,UpDownBitmap)
else}
PaintInplaceButton(Canvas, EditToButtonStyle[AEditStyle], ARect1, ACellRect,
0, False, Flat, DataLink.Active, Canvas.Brush.Color, nil);
if Flat and The3DRect then
FillRect(Rect(ARect1.Left - 1, ARect1.Top, ARect1.Left, ARect.Bottom));

Inc(ARect1.Left, FInplaceEditorButtonWidth);
end;
for i := 0 to DrawColumn.EditButtons.Count - 1 do
if DrawColumn.EditButtons.Visible then
begin
if DrawColumn.EditButtons.Width > 0
then AButtonWidth := DrawColumn.EditButtons.Width + AEditLineWidth
else AButtonWidth := FInplaceEditorButtonWidth;
ARect1.Right := ARect1.Left + AButtonWidth;
PaintInplaceButton(Canvas, DrawColumn.EditButtons.Style,
ARect1, ACellRect, 0, False, Flat, DataLink.Active, Canvas.Brush.Color,
DrawColumn.EditButtons.Glyph);
if Flat and The3DRect then
FillRect(Rect(ARect1.Left - 1, ARect1.Top, ARect1.Left, ARect.Bottom));
Inc(ARect1.Left, AButtonWidth);
end;

if FInplaceEditorButtonHeight < DefaultRowHeight then
FillRect(Rect(ARect.Right, ARect1.Bottom, ARect.Right + AButtonsWidth, ARect.Bottom));
end;
if Columns.State = csDefault then
DrawDataCell(ARect, DrawColumn.Field, AState);
DrawColumnCell(ARect, ACol, DrawColumn, AState);
if FInplaceSearching
and (gdSelected in AState)
and IsCurrentRow(FOldActiveRecord)
and (ACol + IndicatorOffset = Col)
and ((dgAlwaysShowSelection in Options) or Focused)
and not (csDesigning in ComponentState)
and (UpdateLock = 0)
and (ValidParentForm(Self).ActiveControl = Self)
then DrawInplaceSearchText;
if DrawColumn.AlwaysShowEditButton and (AEditStyle <> esSimple) and Flat
then ARect.Right := ARect.Right + AButtonsWidth;
finally
InstantReadRecordLeave;
// DataLink.ActiveRecord := OldActive;
end;
end else // Draw Footer Cells
if {Assigned(OnDrawFooterCell) and}
(FooterRowCount > 0) and
(ARow > RowCount - FooterRowCount - 1 - TopDataOffset) then
begin

Footer := DrawColumn.UsedFooter(FooterRowCount - RowCount + ARow + TopDataOffset);
Font := Footer.Font;
Brush.Color := Footer.Color;

if FDefaultDrawing then
begin
FColCellParamsEh.FBackground := Brush.Color;
NewAlignment := Footer.Alignment;
Value := GetFooterValue(FooterRowCount - RowCount + ARow + TopDataOffset, DrawColumn);

GetFooterParams(ACol, FooterRowCount - RowCount + ARow + TopDataOffset, DrawColumn, Font,
FColCellParamsEh.FBackground, NewAlignment, AState, Value);

CellMultiSelected := CellIsMultiSelected(ACol + IndicatorOffset, ARow + TopDataOffset, DataCol, '');
Highlight := HighlightNoDataCellColor(ACol + IndicatorOffset, ARow + TopDataOffset,
DataCol, DataRow, CellType, AState, CellMultiSelected, FColCellParamsEh.FBackground, Canvas.Font);

Canvas.Brush.Color := FColCellParamsEh.FBackground;
//shj add
if DrawColumn.IsCurrency and DrawCurrency then //shj Add金额线
begin FCurrencyStyle.PaintBody(Self.Canvas,Value,ARect);NeedPaintHead:=false;end else
//shj end

WriteCellText {WriteTextEh}(Canvas, ARect, True, XFrameOffs, YFrameOffs, Value,
NewAlignment, tlTop, Footer.WordWrap and FAllowWordWrap, Footer.EndEllipsis, 0, 0);
end;

if Assigned(OnDrawFooterCell) then
OnDrawFooterCell(Self, ACol, FooterRowCount - RowCount + ARow + TopDataOffset, DrawColumn, ARect, AState);
//fs add+
end else // Draw Empty Currency Cells
if ((ARow >= 0) and DrawColumn.IsCurrency and DrawCurrency) then begin
FCurrencyStyle.PaintBody(Self.Canvas,'',ARect) ;
CellHeigth:=ARect.Bottom-ARect.Top; //不含上下线
line:=ARect.Top;
while (CellHeigth>RowHeight+1) do begin
line:=line+RowHeight+1;
PointArray[0]:=point(ARect.Left,line);
PointArray[1]:=point(ARect.Right,line);
PolyLine(PointArray);
CellHeigth:=CellHeigth-rowHeight-1 ;
end;
//fs add--
end else // Empty space between Data and Footer Cells
begin
CellMultiSelected := CellIsMultiSelected(ACol + IndicatorOffset, ARow + TopDataOffset, DataCol, '');
FColCellParamsEh.FBackground := Brush.Color;
Highlight := HighlightNoDataCellColor(ACol + IndicatorOffset, ARow + TopDataOffset,
DataCol, DataRow, CellType, AState, CellMultiSelected, FColCellParamsEh.FBackground, Canvas.Font);
Brush.Color := FColCellParamsEh.FBackground;
FillRect(ARect);
//fs add++
CellHeigth:=ARect.Bottom-ARect.Top; //不含上下线
line:=ARect.Top;
while (CellHeigth>RowHeight+1) do begin
line:=line+RowHeight+1;
PointArray[0]:=point(ARect.Left,line);
PointArray[1]:=point(ARect.Right,line);
PolyLine(PointArray);
CellHeigth:=CellHeigth-rowHeight-1 ;
end;
//fs add--
end;

if DefaultDrawing and (gdFocused in AState)
and ({(dgAlwaysShowSelection in Options) or }Focused)
and not (csDesigning in ComponentState)
and not (dgRowSelect in Options)
and (UpdateLock = 0)
and (ValidParentForm(Self).ActiveControl = Self) then
Windows.DrawFocusRect(Handle, ARect);
end;
end;

if The3DRect then
begin
InflateRect(ARect, 1, 1);
DrawEdgeEh(Canvas, ARect, Down, Highlight, True, True);
end;

if (ARow < 0) and (ARow = -TopDataOffset) and (dgTitles in Options) and
(ACol >= 0) and (FUseMultiTitle = True) then
with DrawColumn.Title do
begin // Draw mastertitle
Canvas.Font := TitleFont;
if Highlight then
begin
BackColor := Canvas.Brush.Color;
Highlight := HighlightNoDataCellColor(ACol + IndicatorOffset, ARow + TopDataOffset,
DataCol, DataRow, CellType, AState, CellMultiSelected, BackColor, Canvas.Font);
Canvas.Brush.Color := BackColor;
end else
Canvas.Brush.Color := FixedColor;
if (FLeafFieldArr[ACol].FLeaf.Host <> nil) {and (FLeafFieldArr[ACol].FLeaf.Host.Drawed = False)} then
begin
DrawHost(FLeafFieldArr[ACol].FLeaf, ARect, EndEllipsis);
end;
end;
end;
 
没错,DelphiBox上有高手回应说4.X版的DrawCell和3.X版的有些不同.
flysand,这段代码可以放在4.X版里替换掉吗?
TKS!
 
不可以!
如果仅要加坚线,
在4.14中在找到 DrawCell中的
画 Empty space between Data and Footer Cells
的地方,补几根线上去就OK了.
 
FooterRowCount设置成1就行了啊,没有其它的了,很简单的啊。
 
只设置FooterRowCount是不行的.你那个应该是3.X版,我们说的是4.X版的
 
flysand, Empty space between Data and Footer Cells
的地方,补几根线上去就OK了.

请详解,谢谢,
 
以前3.6是可以的,,现在升级了新版,客户的分辨率都很高了,不习惯
 
注意,我只要像3.6那样有直线就行了,空白的地方不要横线,
 
后退
顶部