delph stringDbgrid 颜色

chushouTV 2018-11-16 04:49:37


现有数量跟最大数量和最小数量比较 改变 计划采购量里面的颜色
...全文
165 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
victor_yang 2019-03-20
  • 打赏
  • 举报
回复


procedure TForm_SumBill0.SHDBGridEh1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
var
Times1,vMax:Real;
begin
inherited;

if (Column.FieldName='BFCount') or (Column.FieldName='CCCount') then
begin
if (QueryBill1.FieldByName('BFCount').AsFloat=0) or (QueryBill1.FieldByName('CCCount').AsFloat=0) then
Exit;
Times1:=Abs(QueryBill1.FieldByName('BFCount').AsFloat - QueryBill1.FieldByName('CCCount').AsFloat);
vMax:= Max(QueryBill1.FieldByName('BFCount').AsFloat , QueryBill1.FieldByName('CCCount').AsFloat);

if (vMax>0) and (Times1/vMax>0.1) then
begin
SHDBGridEh1.Canvas.Font.Color:=$002209D2;
end;
SHDBGridEh1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;



zhitaoyang 2019-01-17
  • 打赏
  • 举报
回复
procedure TLForm.sGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin

if (ARow=行) and(ACol=列) then
begin
with sGrid do
begin
//设置颜色
Canvas.Brush.Color := RGB(227,249,248);
Canvas.TextRect(rect,rect.Left+2,rect.Top+2,Cells[acol, arow]);
Canvas.FrameRect(Rect);
end;
end;
end;

5,928

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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