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

Вниз

StringGrid   Найти похожие ветки 

 
saNat ©   (2004-10-09 02:54) [0]

Подскажите, пожалуйста, как выделить строку в данном компоненте. Ну, например, сделать выделение (bold) шрифта или изменение его цвета?

С уважением...


 
GanibalLector ©   (2004-10-09 03:02) [1]

В DrawCell писать что-то тира

with stringgrid1.Canvas do begin
...
if  gdselected in state then begin
Brush.Color := $cbe08b;
Font.Style:=[fsBold];
FillRect(Rect);
Font.Color := clblack;
...


 
GanibalLector ©   (2004-10-09 03:02) [2]

В DrawCell писать что-то типа

with stringgrid1.Canvas do begin
...
if  gdselected in state then begin
Brush.Color := $cbe08b;
Font.Style:=[fsBold];
FillRect(Rect);
Font.Color := clblack;
...


 
saNat ©   (2004-10-10 01:01) [3]

Виноват... Не так, возможно, выразился.

Предположим, есть StringGrid такого содержания


11/10/2004 - Значение 1
11/10/2004 - Значение 2
11/10/2004 - Значение 3
11/10/2004 - Значение 4
10/10/2004 - Значение 1
10/10/2004 - Значение 2
10/10/2004 - Значение 3
10/10/2004 - Значение 4
09/10/2004 - Значение 1
09/10/2004 - Значение 2
09/10/2004 - Значение 3


Выделить нужно, например, значения за сегодняшнюю дату - 11/10/2004



11/10/2004 - Значение 1
11/10/2004 - Значение 2
11/10/2004 - Значение 3
11/10/2004 - Значение 4

10/10/2004 - Значение 1
10/10/2004 - Значение 2
10/10/2004 - Значение 3
10/10/2004 - Значение 4
09/10/2004 - Значение 1
09/10/2004 - Значение 2
09/10/2004 - Значение 3


С уважением...


 
GanibalLector ©   (2004-10-10 02:02) [4]

Во первых,сегодня 10.10.2004 ,а не 11.
Во вторых,ты начинаешь мне не нравиться!!!То так,то эдак.Определись!!!

Ладно,вот :
Option RowSelect=TRUE

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
 Rect: TRect; State: TGridDrawState);
begin
with StringGrid1.Canvas do begin
if (Acol<>0) and (Arow<>0)  then begin
if StringGrid1.Cells[1,Arow]=Datetostr(now) then begin
Brush.Color := $cbe08b;
Font.Style:=[fsBold];
FillRect(Rect);
Font.Color := clblack;
if textwidth(Stringgrid1.cells[Acol,Arow])>=Rect.Right-Rect.Left
then textout(rect.left+2 ,Rect.top+4,stringgrid1.Cells[Acol,Arow]) else
textout(rect.left+(rect.right-rect.left -
textwidth(stringgrid1.cells[Acol,Arow])) div 2 ,
Rect.top+4,stringgrid1.Cells[Acol,Arow]);
                                    end else begin
Brush.Color := $b0ffff;
FillRect(Rect);
Font.Color := clblack;
if textwidth(Stringgrid1.cells[Acol,Arow])>=Rect.Right-Rect.Left
then textout(rect.left+2 ,Rect.top+4,stringgrid1.Cells[Acol,Arow]) else
textout(rect.left+(rect.right-rect.left -
textwidth(stringgrid1.cells[Acol,Arow])) div 2 ,
Rect.top+4,stringgrid1.Cells[Acol,Arow]);
                                             end;
                          end
                          else begin
Brush.Color := clbtnface;
FillRect(Rect);
Font.Color := clblack;
textout(rect.left+(rect.right-rect.left -textwidth(stringgrid1.cells[Acol,Arow])) div 2  ,
Rect.top+4,stringgrid1.Cells[Acol,Arow]);
                          end; end;
                           end;

procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.Cells[2,2]:="Значение1";
StringGrid1.Cells[2,3]:="Значение2";
StringGrid1.Cells[2,4]:="Значение3";
StringGrid1.Cells[2,5]:="Значение4";
StringGrid1.Cells[2,6]:="Значение5";
StringGrid1.Cells[1,2]:="10.10.2004";
StringGrid1.Cells[1,3]:="11.10.2004";
StringGrid1.Cells[1,4]:="9.10.2004";
StringGrid1.Cells[1,5]:="10.10.2004";
end;


 
saNat ©   (2004-10-10 11:13) [5]

Спасибо. Просто неправильно задал вопрос...



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

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

Наверх




Память: 0.48 MB
Время: 0.029 c
1-1097475155
Леха
2004-10-11 10:12
2004.10.24
Нужен пример создания помощи в Делфи


14-1095845490
olookin
2004-09-22 13:31
2004.10.24
Прогнозы на 2-й тур Лиги Чемпионов


1-1096990268
diabolik_krsk
2004-10-05 19:31
2004.10.24
Проблема с объявлением типизированного файла


3-1095744487
Fishka
2004-09-21 09:28
2004.10.24
Level DBF-файлов 5 и 7 - какое это имеет значение?


3-1096028563
Hro
2004-09-24 16:22
2004.10.24
Стандартный пароль или логин