PDA

Просмотр полной версии : Delphi StringGrid


Sin3v
22.02.2009, 22:07
http://s48.radikal.ru/i122/0902/94/2e7841c6775d.jpg

Как сделать чтобы в две строки писалось?

StringGrid1.Cells[18,0]:= 'Прочие услуги' + #13 + '(доставка)'; так неканает(

eLWAux
22.02.2009, 22:40
в обработчик DrawCell допиши:

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
StringGrid1.Canvas.FillRect(Rect);
DrawText(
StringGrid1.Canvas.Handle,
Pchar(StringGrid1.Cells[Acol, Arow]),
Length(StringGrid1.Cells[Acol, Arow]),
Rect, dt_calcrect Or dt_wordbreak Or dt_left);

If (Rect.bottom - Rect.top) <> StringGrid1.RowHeights[ARow] Then
StringGrid1.RowHeights[ARow] := (Rect.bottom - Rect.top)
Else

DrawText(
StringGrid1.Canvas.Handle,
Pchar(StringGrid1.Cells[Acol, Arow]),
Length(StringGrid1.Cells[Acol, Arow]),
Rect, dt_wordbreak Or dt_left);

end;
и компонент сам поставит переносы там, где надо

eLWAux
22.02.2009, 22:43
^^
http://s40.radikal.ru/i088/0902/45/915b69005a9ft.jpg (http://radikal.ru/F/s40.radikal.ru/i088/0902/45/915b69005a9f.jpg.html)

eLWAux
22.02.2009, 23:06
p.s.: скорость работы отрисовки очень долгая (

можеш использоватькомпоненти:
TEmiStringGrid
TKStringGrid
http://www.torry.net/pages.php?s=73
http://www.delphipages.com/result.cfm?ID=2863

вот почитай:
http://subscribe.ru/archive/comp.soft.prog.delphiplus/200706/05210132.html

De-visible
23.02.2009, 00:48
сиськи!
Закрыто вообщем, вопрос решен.