Subject | AW: [IBO] IB_Grid cells color |
---|---|
Author | Steffen Frank |
Post date | 2001-08-09T09:33:15Z |
Hi I have draw a red Column, try it to the Cell
Good luck
procedure TfrmEUP.dbgrid_TeileListeDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
procedure proc_FarbeSetzen(DefaultColor, ExceptionColor:TColor);
begin
with dbgrid_TeileListe do
begin
if Column.FieldName ='SMEMO' then
begin
Canvas.Font.Color:=ExceptionColor;
Canvas.Font.Style:=[fsBold];
end;
end;
end;
begin
with dbgrid_TeileListe do
begin
//Setze Hindergrund-Farbe
if (gdSelected in State) then
Canvas.Brush.Color:=clActiveCaption
else Canvas.Brush.Color:=clwhite;
//Setze Vordergrund-Farbe
if not bo_InterbaseException then
begin
if dmEUP.qryElvis203.IsEmpty then
exit;
if dmEUP.qryElvis203.FieldByName('SBENUTZERMEMO').asString = 'u'
then
begin
if Canvas.Brush.Color = clActiveCaption then
proc_FarbeSetzen(clwhite,clRed)
else
proc_FarbeSetzen(clblack,clRed);
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end; // end -> with dbg_TeileListe do
end;
Best Regards
-----Ursprungliche Nachricht-----
Von: manuelfresnedaguerra@... [mailto:manuelfresnedaguerra@...]
Gesendet: Donnerstag, 9. August 2001 10:59
An: IBObjects@yahoogroups.com
Betreff: [IBO] IB_Grid cells color
Hi all,
How can i draw a cell with a color if i has a determinate value,
i try whith OnGetCellColor, but when the cell lost the focus the
color change.
I try with this:
procedure TForm1.IB_Grid1GetCellColor(Sender: TObject; ACol, ARow:
Integer;
AState: TGridDrawState; var AColor: TColor);
begin
with IB_Grid1 do
begin
{Pone la celda en Amarillo si es el precio y es menor que 0}
if ARow = Row then
if ACol = Col then
if (Assigned( GridFields[ DataCol[ACol]])) and
(GridFields[ DataCol[ACol]].FieldName = 'ARTPRE') then
if IB_Query1.FieldByName('artpre').AsFloat < 0 then
AColor := clYellow;
end;
end;
Thanks.
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
Good luck
procedure TfrmEUP.dbgrid_TeileListeDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
procedure proc_FarbeSetzen(DefaultColor, ExceptionColor:TColor);
begin
with dbgrid_TeileListe do
begin
if Column.FieldName ='SMEMO' then
begin
Canvas.Font.Color:=ExceptionColor;
Canvas.Font.Style:=[fsBold];
end;
end;
end;
begin
with dbgrid_TeileListe do
begin
//Setze Hindergrund-Farbe
if (gdSelected in State) then
Canvas.Brush.Color:=clActiveCaption
else Canvas.Brush.Color:=clwhite;
//Setze Vordergrund-Farbe
if not bo_InterbaseException then
begin
if dmEUP.qryElvis203.IsEmpty then
exit;
if dmEUP.qryElvis203.FieldByName('SBENUTZERMEMO').asString = 'u'
then
begin
if Canvas.Brush.Color = clActiveCaption then
proc_FarbeSetzen(clwhite,clRed)
else
proc_FarbeSetzen(clblack,clRed);
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end; // end -> with dbg_TeileListe do
end;
Best Regards
-----Ursprungliche Nachricht-----
Von: manuelfresnedaguerra@... [mailto:manuelfresnedaguerra@...]
Gesendet: Donnerstag, 9. August 2001 10:59
An: IBObjects@yahoogroups.com
Betreff: [IBO] IB_Grid cells color
Hi all,
How can i draw a cell with a color if i has a determinate value,
i try whith OnGetCellColor, but when the cell lost the focus the
color change.
I try with this:
procedure TForm1.IB_Grid1GetCellColor(Sender: TObject; ACol, ARow:
Integer;
AState: TGridDrawState; var AColor: TColor);
begin
with IB_Grid1 do
begin
{Pone la celda en Amarillo si es el precio y es menor que 0}
if ARow = Row then
if ACol = Col then
if (Assigned( GridFields[ DataCol[ACol]])) and
(GridFields[ DataCol[ACol]].FieldName = 'ARTPRE') then
if IB_Query1.FieldByName('artpre').AsFloat < 0 then
AColor := clYellow;
end;
end;
Thanks.
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]