Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2002.02.18;
Скачать: [xml.tar.bz2];

Вниз

Как в RXDBGrid текущию строку сделать с другим Font или цветом?   Найти похожие ветки 

 
Fran   (2002-01-24 09:59) [0]

Как в RXDBGrid текущию строку сделать с другим Font или цветом?
Т.е. строку где стоит курсор.


 
savva   (2002-01-24 10:01) [1]

а перерисовывать самостоятельно не пробовал?


 
gek   (2002-01-24 10:10) [2]


procedure TForm_find.RxDBGrid_findGetCellParams(Sender: TObject; Field: TField;
AFont: TFont; var Background: TColor; Highlight: Boolean);
begin
if(Highlight)and(RxDBGrid_find.Focused) then
begin
AFont.Color := clHighlightText;
Background := clHighlight;
end
else if(Highlight)and( not RxDBGrid_find.Focused)then
begin
AFont.Color := clnavy;
Background := clbtnface;
end;
end;


 
Alexandr   (2002-01-24 10:29) [3]

это по-моему для только для текущей ячейки, а для все текущей строки надо по-другому


 
Alexandr   (2002-01-24 10:29) [4]

кстати, в кулибе написано как делать


 
savva   (2002-01-24 10:47) [5]

Delphi Help ©
The following example conditionally changes the font color of rows in a DB Grid. The following code is added to the DB Grid’s OnDrawDataCell event. If the field Size is greater than 10, the row’s font will be red.

procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState);

begin
if Table1.FieldByName("Size").AsFloat > 10 then
DBGrid1.Canvas.Font.Color := clRed;
DBGrid1.DefaultDrawDataCell(Rect, Field, State);
end;

надо привязываться к State:

Description

TGridDrawState represents state information about the cell of a grid that is being rendered. It is a set that includes 0 or more of the following:

Value Meaning

gdSelected The cell is currently selected.
gdFocused The cell has input focus.
gdFixed The cell is in the fixed region of the grid.

то есть тебе надо gdFocused - и все...


 
savva   (2002-01-24 10:51) [6]

а что бу перерисовать все строку - ИМХО просто пройтись по горизонтали от 1 столбца к последнему...


 
Alexandr   (2002-01-24 11:02) [7]

вот что в кулибе написано по поводу выделения цветом всей текущей строки


DefaultDrawing:=False;
....
procedure TfrmCard.GridDrawColumnCell(Sender: TObject; constRect: TRect;

DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var

Index : Integer;
Marked, Selected: Boolean;
begin


Marked := False;
if (dgMultiSelect in Grid.Options) and THackDBGrid(Grid).Datalink.Active then
Marked:=Grid.SelectedRows.Find(THackDBGrid(Grid).Datalink.Datasource.Dataset.Bookmark,Index);


Selected := THackDBGrid(Grid).Datalink.Active and (Grid.Row-1 = THackDBGrid(Grid).Datalink.ActiveRecord);


if Marked then
begin
Grid.Canvas.Brush.Color:=$DFEFDF;
Grid.Canvas.Font.Color :=clBlack;
end;


if Selected then
begin
Grid.Canvas.Brush.Color:=$FFFBF0;
Grid.Canvas.Font.Color :=clBlack;
if Marked then
Grid.Canvas.Brush.Color:=$EFE3DF; { $8F8A30 }
end;


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

где



--------------------------------------------------------------------------------
THackDBGrid = class(TDBGrid)

property DataLink;
property UpdateLock;
end;

Обратите внимание на обьявление класса THackDBGrid. Таким образом можно получить доступ к приватным полям, свойствам и методам класса, что, к сожалению, приходится делать, если авторы исходного класса оказались не предусмотрительны. [001138




 
Fran   (2002-01-24 15:48) [8]

Спасибо, последний совет Alexandr (24.01.02 11:02) самый правильный. Все получилось. А в Кулибе я этого аочему-то не нашел :(



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

Форум: "Базы";
Текущий архив: 2002.02.18;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.004 c
1-57073
Злой_Гном
2002-02-01 18:23
2002.02.18
Все, про ProgressBar дотумкал :-)))


1-57054
BJValentine
2002-01-27 11:31
2002.02.18
DBGrid


14-57221
ProfiUgl
2001-12-27 16:07
2002.02.18
Откуда можно скачать Update Pack 1 для Delphi5 и ADO Express Update 1 и 2


3-57035
dm
2002-01-25 13:50
2002.02.18
RecordSet


1-57143
EsKor
2002-01-31 08:37
2002.02.18
Свойство Enabled компонента TGroupBox





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский