我这儿有类似速达的表格控件源码,如果有人能帮忙改进的话我就公开源码!(3)

xjj77085 2003-03-22 11:18:16

finally
DataLink.ActiveRecord := OldActive;
end;
if DefaultDrawing and (gdSelected 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;
end;

var
OldActive: Integer;
// Indicator: Integer;
Highlight: Boolean;
Value: string;
// MultiSelected: Boolean;
// ALeft: Integer;
DrawColumn: TQLColumn;
SaveColor: TColor;

begin
SaveColor := Color;
FColorChangeLocked := True;
try
if Odd(ARow - TitleOffset) then Color := AlternateColor;
finally
FColorChangeLocked := False;
end;
try
if ((gdFixed in AState) and (ACol < IndicatorOffset)) or
not Assigned(DataLink) or not DataLink.Active or (ARow - TitleOffset < DataLink.RecordCount) then
inherited DrawCell(ACol, ARow, ARect, AState)
else begin
DrawDataCell(ACol, ARow, ARect, AState);
end;
// Dec(ACol, IndicatorOffset);
// Dec(ARow, TitleOffset);
// DrawColumn := Columns[ACol];
// ARow >= FFooterRowCount - RowCount + ARow + FTitleOffset
if (FFooterRowCount - RowCount + ARow >= 0) and (ACol >= IndicatorOffset) then
begin
// Dec(ACol, IndicatorOffset);
// Dec(ARow, TitleOffset);
// DrawColumn := Columns[ACol];
DrawFooterCell(ACol, ARow, ARect);//财务
Exit;
end;

// if (gdFixed in AState) or ((ARow <= DataLink.DataSet.RecordCount) and
// ((ARow - TitleOffset < DataLink.RecordCount) or
// ((DataLink.DataSet.State = dsInsert) and ((ARow - TitleOffset + 1) = DataLink.RecordCount)))) then
// inherited DrawCell(ACol, ARow, ARect, AState)
// else
// DrawDataCell(ACol, ARow, ARect, AState);

// Draw Currency Cell
if (dgCurrencyView in OptionsEx) and not ((gdFixed in AState) and (ACol < IndicatorOffset)) and
not (csLoading in ComponentState) then
begin
if Assigned(DataLink) and DataLink.Active then
begin
Dec(ACol, IndicatorOffset);
Dec(ARow, TitleOffset);
DrawColumn := Columns[ACol];
with DrawColumn do
if not Showing or
(not (Assigned(Field) and
((Field is TCurrencyField) or
((Field is TFloatField) and TFloatField(Field).Currency) or
((Field is TBCDField) and TBCDField(Field).Currency) or
((Field is TAggregateField) and TAggregateField(Field).Currency)))) then Exit;

with Canvas do
begin
// FCurrencyView.DigitWidth := TextWidth('0') + 4;
if (gdFixed in AState) and ([dgRowLines, dgColLines] * Options =
[dgRowLines, dgColLines]) then
begin
InflateRect(ARect, -1, -1);
FrameOffs := 1;
end
else FrameOffs := 2;
if not (gdFixed in AState) then
begin
Font := DrawColumn.Font;
Brush.Color := DrawColumn.Color;
end;
if (ARow < 0) and FCurrencyView.CurrencyTitle then
DrawCurrencyTitleCell(ACol + IndicatorOffset, ARow, DrawColumn, AState)//表头
else if (ARow >= 0) and not (DataLink = nil) and DataLink.Active then
begin
// Value := '';
OldActive := DataLink.ActiveRecord;
try
DataLink.ActiveRecord := ARow;
Highlight := HighlightCell(ACol, ARow, Value, AState);
if Highlight then
begin
Brush.Color := clHighlight;
Font.Color := clHighlightText;
end;
if not Enabled then Font.Color := clGrayText;
if DefaultDrawing then
DrawCurrencyCell(ACol + IndicatorOffset, ARow + TitleOffset, DrawColumn, AState);//表体
finally
DataLink.ActiveRecord := OldActive;
end;
// end;
if DefaultDrawing and (gdSelected 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;
end;
end;
finally
FColorChangeLocked := True;
try
Color := SaveColor;
finally
FColorChangeLocked := False;
end;
end;
end;
...全文
19 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
mydhl 2003-03-24
  • 打赏
  • 举报
回复
看不清

2,496

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧