Текущий архив: 2004.10.24;
Скачать: CL | DM;
ВнизDbgrid Найти похожие ветки
← →
ex_ (2004-10-12 15:35) [0]Уважаемые Мастера!
Посмотрите почему, не прорисовываются
картинки, и при фильтрации цветные ячейки
исчезают.
Спасибо!
/////////////////////////////////////////////////////////
procedure Tmain_child_f.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
Im1: TBitmap;
Im2: TBitmap;
begin
Im1:=TBitmap.Create;
if (Column.FieldName="DATE_W" )then
begin
with
DBGrid1.Canvas do
begin
Brush.Color:=clWhite;
FillRect(Rect);
if (Table1.FieldByName("DATE_W").Value=(STRTODATE("01.09.2004")))
then
begin
ImageList1.GetBitmap(0,Im1);
end
else
begin
if (Table1.FieldByName("DATE_W").Value=(STRTODATE("01.09.2004")))
THEN ImageList1.GetBitmap(2,Im1);
end;
Draw(round((Rect.Left+Rect.Right-Im1.Width)/2),Rect.Top,Im1);
im1:=nil;
end;
end;
Im2:=TBitmap.Create;
if (Column.FieldName="EXPEL" ) then
begin
with
DBGrid1.Canvas do
begin
Brush.Color:=clWhite;
FillRect(Rect);
if (Table1.FieldByName("EXPEL").Value=8)
then
begin
ImageList1.GetBitmap(1,Im2);
end
else
begin
if (Table1.FieldByName("EXPEL").Value=8)
THEN ImageList1.GetBitmap(1,Im2);
end;
Draw(round((Rect.Left+Rect.Right-Im2.Width)/2),Rect.Top,Im2);
im2:=nil;
End;
end;
begin
with table1 do
dbGrid1.canvas.brush.color := clwindow;
dbgrid1.Columns.Items[5].Color:= main_f.ColorDialog1.Color;
dbGrid1.canvas.fillRect(rect);
END;
if gdSelected in state then
begin
dbGrid1.canvas.brush.color := main_f.ColorDialog1.Color;
dbgrid1.Canvas.FrameRect(rect);
dbgrid1.Canvas.FillRect(rect);
dbgrid1.Canvas.Font.Size:=9;
if fsBold in dbGrid1.canvas.font.style then
begin
dbGrid1.canvas.font.color := clwindow;
dbgrid1.Canvas.FrameRect(rect);
dbgrid1.Canvas.FillRect(rect);
dbGrid1.canvas.font.style := [fsBold];
dbgrid1.Canvas.Font.Size:=9;
end
else
dbGrid1.canvas.font.color := clwindow;
end
else if gdFocused in state then
begin
dbGrid1.canvas.brush.color := clWindow;
if fsBold in dbGrid1.canvas.font.style then
begin
dbGrid1.canvas.font.color := clWindowText;
dbGrid1.canvas.font.style := [fsBold];
dbgrid1.Canvas.Font.Size:=9;
end
else
dbGrid1.canvas.font.color := clWindowText;
end
else if gdFixed in state then
begin
dbGrid1.canvas.brush.color := clHighlight;
if fsBold in DBGrid1.canvas.font.style then
begin
dbgrid1.Columns[5].Color:=main_f.ColorDialog1.Color;
dbGrid1.canvas.font.color := clHighlightText;
dbGrid1.canvas.font.style := [fsBold];
dbgrid1.Canvas.Font.Size:=9;
end
else
dbGrid1.canvas.font.color := clHighlightText;
end;
with table1 do
begin
if (fieldByName("Kind").Value = "Êîììåð÷åñêîå")then
with dbgrid1.Canvas do
begin
Brush.Color:=$00DEEBEF;
Font.Color:=clblack;
FillRect(Rect);
END;
if (fieldByName("Kind").Value = "Íåêîììåð÷åñêîå (öåëåâîå)")then
with dbgrid1.Canvas do
begin
Brush.Color:=$00B9E6FD;
Font.Color:=clblack;
FillRect(Rect);
end;
with table1 do
begin
if (fieldByName("Course").Value < 0) then
DBgrid1.Canvas.font.color := clred;
END;
DBGrid1.canvas.textOut(rect.left + 2, rect.top + 2, column.field.text);
END;
END;
А как можно изменить цвет сетки-линий?
← →
Johnmen © (2004-10-12 15:49) [1]http://www.delphikingdom.com/helloworld/dbgridcolor.htm
Страницы: 1 вся ветка
Текущий архив: 2004.10.24;
Скачать: CL | DM;
Память: 0.45 MB
Время: 0.038 c