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

Вниз

StringGrid цвет шрифта в каждой ячейке   Найти похожие ветки 

 
scorpi   (2004-02-06 14:32) [0]

Как в двух разных ячейках писать слова разными цветами не через OnDrawCell????


 
alless   (2004-02-06 14:38) [1]

Peredelai cto tebe nado:
type
TStrColor = class(TObject)
public
Color : TColor; {вы могли бы также определить частные и
публичные методы доступа}
end;
...
procedure TForm1.FormCreate(Sender:TObject)
var
i,j : Integer;
begin
With StringList1 do
for i := 0 to ColCount-1
for j := 0 to RowCount-1
Objects[i,j] := TStrColor.Create;
end;
...
procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Longint;
Rect: TRect; State: TGridDrawState);
var
OldColor : TColor;
begin
with StringGrid1.Canvas do begin
OldColor := Font.Color;
Font.Color := (StringGrid1.Objects[col,row] as TStrColor).Color;
TextOut(Rect.Left+2,Rect.Top+2,StringGrid1.Cells[Col,Row]);
Font.Color := OldColor;
end;
end;
...
procedure TForm1.ProcessSelection(Sender: TObject);
var
i,j : Integer;
begin
With StringGrid1.Selection do
For i := left to right do
for j := top to bottom do
MessageDlg(IntToStr(i)+","+IntToStr(j)+"-"+
IntToStr((StringGrid1.Objects[i,j] as TStrColor).Color),
mtInformation,[mbOk],0);
end;


 
Alexander666   (2004-02-06 14:44) [2]

Вообще-то никак...


 
Alexander666   (2004-02-06 14:46) [3]

А теперь уже есть как :-)


 
alless   (2004-02-06 14:48) [4]

ups! ne rasmotrel cto nado ispolizovati bez OnDrawCell. Sorry


 
Alexander666   (2004-02-06 14:50) [5]

Короче, мой тебе ответ, НИКАК!


 
olookin   (2004-02-06 14:53) [6]

Alexander666 © (06.02.04 14:50) [5]

Можно. Просто на канве рисовать.

with StringGrid1 do begin
with Canvas do begin Brush.Color:=clBlack;
Font.Color:=clYellow;
Font.Style:=[fsBold]; Font.Name:="MS Sans Serif"; end;
for i:=0 to RowCount-1 do begin
xc:=CellRect(0,i).Left; yc:=CellRect(0,i).Top;
Canvas.FillRect(CellRect(0,i));
Canvas.TextRect(CellRect(0,i),xc+2,yc+2,"fytyry");
end; end;



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

Форум: "Основная";
Текущий архив: 2004.02.17;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.008 c
14-53759
N169
2004-01-26 14:30
2004.02.17
Распознавание геометрических фигур


7-53780
Геннадий
2003-11-21 08:02
2004.02.17
Запуск прогаммы с привилегиями администратора


14-53715
Карелин Артем
2004-01-29 13:58
2004.02.17
Глюк?


14-53708
Ig
2004-01-27 22:50
2004.02.17
Prince Of Persia : The Sands of Time


1-53522
turonix
2004-02-04 16:17
2004.02.17
Проблемы с компилятором





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский