Home > Back-end >  Delph stringDbgrid color
Delph stringDbgrid color

Time:11-15



Existing quantity with maximum and minimum quantity is change the plan purchases the color inside

CodePudding user response:

Procedure TLForm. SGridDrawCell (Sender: TObject; ACol,
ARow: Integer; The Rect: TRect; State: TGridDrawState);
The begin

If (ARow=line) and (ACol=column) then
The begin
With sGrid do
The begin
//set colors
Canvas. Brush. Color:=RGB (227249248);
Canvas. TextRect (the rect, the rect. Left + 2, the rect. Top + 2, Cells [acol, arow]);
Canvas. FrameRect (the Rect);
end;
end;
end;

CodePudding user response:

 

Procedure TForm_SumBill0. SHDBGridEh1DrawColumnCell (Sender: TObject;
Const the Rect: TRect; DataCol: Integer; Column: TColumnEh;
State: TGridDrawState);
Var
Times1, vMax: Real;
The begin
Inherited;

If (Column. FieldName='BFCount') or (Column. FieldName='CCCount') then
The begin
If (QueryBill1 FieldByName (' BFCount). AsFloat=0) or (QueryBill1. FieldByName (' CCCount). AsFloat=0) then
The 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
The begin
SHDBGridEh1. Canvas. The Font Color:=$002209 d2;
end;
SHDBGridEh1. DefaultDrawColumnCell (the Rect, DataCol, the Column, the State);
end;
end;



  • Related