Delphi StringGrid

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Sin3v, 22 Feb 2009.

Thread Status:
Not open for further replies.
  1. Sin3v

    Sin3v Banned

    Joined:
    16 Jul 2008
    Messages:
    11
    Likes Received:
    95
    Reputations:
    9
    [​IMG]

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

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

    eLWAux Elder - Старейшина

    Joined:
    15 Jun 2008
    Messages:
    860
    Likes Received:
    616
    Reputations:
    211
    в обработчик DrawCell допиши:

    Code:
    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;
    и компонент сам поставит переносы там, где надо
     
    1 person likes this.
  3. eLWAux

    eLWAux Elder - Старейшина

    Joined:
    15 Jun 2008
    Messages:
    860
    Likes Received:
    616
    Reputations:
    211
  4. eLWAux

    eLWAux Elder - Старейшина

    Joined:
    15 Jun 2008
    Messages:
    860
    Likes Received:
    616
    Reputations:
    211
    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
     
  5. De-visible

    De-visible [NDC] Network develope c0ders

    Joined:
    6 Jan 2008
    Messages:
    916
    Likes Received:
    550
    Reputations:
    66
    сиськи!
    Закрыто вообщем, вопрос решен.
     
Loading...
Thread Status:
Not open for further replies.