Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   Delphi StringGrid (https://forum.antichat.xyz/showthread.php?t=107512)

Sin3v 22.02.2009 22:07

Delphi StringGrid
 

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

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

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

сиськи!
Закрыто вообщем, вопрос решен.


Время: 02:44