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

Вниз

выделение записей цветом простом DBGRID е или DBGRIDEH е   Найти похожие ветки 

 
Stas ©   (2003-02-24 16:44) [0]

Если кто знает как выделить запись цветом в простом Dbgride или в Dbgrideh, подскажите пожалуйста.


 
Леший_   (2003-02-24 17:05) [1]

Это небольшой фрагмет в виде примерчика...

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var Im1: TBitmap;
begin
with DBGrid1.Canvas do
begin
if (Column.Field.FieldName = "......") and
not (gdSelected in State) then
if strtofloat(Column.Field.Text)=1 then
begin
Brush.Color:=clRED;
Font.Color:=clWHite;
FillRect(Rect);
TextOut(Rect.Left+2,Rect.Top+2,FormatFloat("### ### ###.##",StrToFloat(Column.Field.Text)));
exit;
end;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State)
end;


 
ermserg ©   (2003-02-24 19:10) [2]

to Leshiy:
Eto ne pravilno i chrevato kuchey Exceptions ( strtofloat(Column.Field.Text) ). Zachem risovat na Canvase esli dostatochno izmenit Font i Brush kak tebe nuzhno i vizvat DefaultDrawColumnCell.
to Stas. Ya 90% uveren, chto etot vopros est v FAQ"e.


 
AM ©   (2003-02-24 19:19) [3]

На королевстве Delphi был?

http://www.delphikingdom.com/helloworld/dbgridcolor.htm


 
ava ©   (2003-02-24 22:53) [4]

procedure TForm1.DBGrid2DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
If ( условие ) then With DBGrid2.Canvas do
Begin

FillRect(Rect);
Font.Color := clRed;
TextOut (Rect.left+1, Rect.Top+2, Column.Field.Text)

end else

DBGrid2.DefaultDrawColumnCell (Rect,DataCol,Column,State)
end;



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

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

Наверх




Память: 0.47 MB
Время: 0.02 c
3-53950
Al11
2003-02-25 13:48
2003.03.17
Query OnFilterRecord


3-53862
Stas
2003-02-24 16:44
2003.03.17
выделение записей цветом простом DBGRID е или DBGRIDEH е


1-54005
Ag2002
2003-03-04 18:19
2003.03.17
Прозрачность


14-54177
i am
2003-03-02 19:25
2003.03.17
нужен компонент


3-53866
Hellraiser2000
2003-02-24 19:29
2003.03.17
Выбор item`a в DBLookupComboBox