Вниз
Скачать: 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 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.015 c
7-54325
cpetfeh
2003-01-21 06:09
2003.03.17
Как управлять USB портом в Delphi


1-54027
multik
2003-03-03 22:32
2003.03.17
Привет всем!!! Как узнать какой символ соответствует координатам.


14-54160
Krusader
2003-02-27 20:08
2003.03.17
?


14-54275
Kkk
2003-02-28 17:10
2003.03.17
8 марта посвящается


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




   Наверх