Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2003.12.16;
Скачать: CL | DM;

Вниз

Как раскрасить Dbgrid в несколько цветов?   Найти похожие ветки 

 
Sanya.   (2003-11-24 14:34) [0]

у меня есть код:

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (table1.FieldByName("Vid").Value="???? ?????") then begin
with dbgrid1.Canvas do begin
{brush.color:=clred; }
font.Color:=clred;
FillRect(rect);
Textout(rect.Left+2,rect.Top+2, column.Field.Text);
end;
end;
end;

Но он раскрашивает только в один цвет, если я ввожу второе условие он его не воспринимает, подскажите как сделать раскраску по нескольким условиям и разными цветами?


 
DenK_vrtz ©   (2003-11-24 14:39) [1]

бумага+фломастер+www.delphikingdom.com/helloworld/dbgridcolor.htm


 
Sanya.   (2003-11-24 14:42) [2]

>DenK_vrtz © (24.11.03 14:39) [1]

Код взят оттуда, но дело в том что он может изменить цвет только по одному условию, а мне надо по нескольким условиям и чтобы в разные цвета....


 
Maxud ©   (2003-11-24 14:44) [3]


procedure TfmFaultsInfo.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if not dmData.tabFaults.FieldByName("Fault_Date").IsNull then
DBGrid1.Canvas.Font.Color := clRed;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;


 
Polevi ©   (2003-11-24 14:44) [4]

if expression then statement

where expression returns a Boolean value. If expression is True, then statement is executed; otherwise it is not


 
Stas ©   (2003-11-24 14:45) [5]

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if (table1.FieldByName("Vid").Value="???? ?????") then begin
with dbgrid1.Canvas do begin
{brush.color:=clred; }
font.Color:=clred;

end;
end
else
begin
with dbgrid1.Canvas do begin
{brush.color:=clred; }
font.Color:=clYellow;

end
end;

TDBGrideh(Sender).DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;


 
Sanya.   (2003-11-24 14:53) [6]

Maxud © (24.11.03 14:44) [3]

Спасибо получилось...



Страницы: 1 вся ветка

Текущий архив: 2003.12.16;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.025 c
3-52095
GIL
2003-11-24 13:22
2003.12.16
Имена полей в SQL


8-52292
emike
2003-08-18 23:29
2003.12.16
тэги формата ogg


1-52162
Коля
2003-12-03 16:04
2003.12.16
TImageList -> TSpeedButton


8-52288
Shur
2003-08-18 17:12
2003.12.16
Распознование текста


14-52352
Игорь Шевченко
2003-11-07 00:30
2003.12.16
Думкин, с днем рождения!!!