DBGRID in the branch, the color setting of the cell

xiaoxiao2021-03-06  112

(1) Different color settings; written in DBGRIDEH1DRAWCOLUMNCELL;

IF adoquery1.recno mod 2 = 0 THEN

Begin

DBGRIDEH1.CANVAS.

Font.color: = CLRED;

DBGRIDEH1.DEFAULTDRAWCOLUMNCELL (Rect, Datacol, Column, State);

end

Else Begin

DBGRIDEH1.CANVAS.

Font.color: = CLGREEN

DBGRIDEH1.DEFAULTDRAWCOLUMNCELL (Rect, Datacol, Column, State);

END;

(2) Branch different background color settings; written in DBGRIDEH1DRAWCOLUMNCELL;

IF adoquery1.recno mod 2 = 0 THEN

Begin

DBGRIDEH1.CANVAS.

Brush.color: = CLRED;

DBGRIDEH1.DEFAULTDRAWCOLUMNCELL (Rect, Datacol, Column, State);

end

Else Begin

DBGRIDEH1.CANVAS.

Brush.color: = clgreen;

DBGRIDEH1.DEFAULTDRAWCOLUMNCELL (Rect, Datacol, Column, State);

END;

(3) Eligible cell color or background color setting; written in DBGRIDEH1DRAWCOLUMNCELL;

IF

Column.fieldName = 'price' Then

Begin

IF

AdoQuery1.fieldbyName ('price') .asfloat <0 THEN

Begin

DBGRIDEH1.CANVAS.FONT.COLOR: = CLRED;

DBGRIDEH1.DEFAULTDRAWCOLUMNCELL (Rect, Datacol, Column, State);

END;

END;

转载请注明原文地址:https://www.9cbs.com/read-100416.html

New Post(0)