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

Вниз

Как закрасить опр. ячейку в StringGride или DrawGride опр. цветом   Найти похожие ветки 

 
maxim2 ©   (2002-10-28 08:19) [0]

Привет всем!
Подскажите кто знает, а то никак.


 
Separator ©   (2002-10-28 08:20) [1]

FillRect


 
MBo ©   (2002-10-28 08:22) [2]

OnDrawCell+Separator © (28.10.02 08:20)


 
Separator ©   (2002-10-28 08:30) [3]

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
Text: string;
begin
Text:= (Sender as TStringGrid).Cells[ACol, ARow];
with (Sender as TStringGrid).Canvas do
begin
Brush.Color:= clBlue;
FillRect(Rect);
TextOut(Rect.Left + 1, Rect.Top + ((Rect.Bottom - Rect.Top - TextHeight(Text)) div 2), Text);
end
end;


 
maxim2 ©   (2002-10-28 09:11) [4]

Не так закрашивается весь StringGrid а мне надо, например кликнул по ячейке и для нее выбрал цвет.


 
Separator ©   (2002-10-28 09:37) [5]

procedure TForm1.StringGrid1Click(Sender: TObject);
var
Text: string;
Rect: TRect;
begin
if ColorDialog1.Execute then
with (Sender as TStringGrid) do
begin
Text:= Cells[Col, Row];
Rect:= CellRect(Col, Row);
with (Sender as TStringGrid).Canvas do
begin
Brush.Color:= ColorDialog1.Color;
FillRect(Rect);
TextOut(Rect.Left + 1, Rect.Top + ((Rect.Bottom - Rect.Top - TextHeight(Text)) div 2), Text);
end;
end
end;

и DefaultDrawing:= false, но придётся самому обрабатывать OnDrawCell


 
maxim2 ©   (2002-10-28 09:43) [6]

Сенкс, все получилось.



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

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

Наверх




Память: 0.48 MB
Время: 0.022 c
1-21522
AndreyAG
2002-10-29 10:47
2002.11.07
TTreeView


14-21730
Me2
2002-10-17 16:10
2002.11.07
Python


1-21671
Злой!!!
2002-10-28 08:48
2002.11.07
Как обработать клик, если кнопка создается внутри программы?


3-21356
arkara
2002-10-21 16:50
2002.11.07
Можно ли в DBGride на поле look-up выводить не одно поле, а два?


3-21404
Youri
2002-10-18 12:34
2002.11.07
Базы даных