Copyright © 2010 Promsite. All Rights Reserved.
стр. 5


TStringGrid, часть I

Автор Деймон Чандлер                                                                перевод Виктор Алексеев aka prom

       //---------------------------------------------------------------------------

       void __fastcall TForm1::FormCreate(TObject *Sender)
       {
          for(int i =0; i< StringGrid1 -> ColCount;i++)
              for(int j =0; j< StringGrid1 -> RowCount;j++)
                StringGrid1 -> Cells[i][j] = "asd";
       }
       //---------------------------------------------------------------------------

И результат на форме:

       void __fastcall RemoveCol(TStringGrid* StringGrid, int Index)
       {
       SendMessage(StringGrid->Handle, WM_SETREDRAW, false, 0);
         try {
           const int col_count = StringGrid->ColCount;
           // (шаг 1) сдвиг содержимого
           // следующих колонок.
          for (int col = Index;col < col_count - 1; ++col)
       {
            StringGrid->Cols[col] = StringGrid->Cols[col + 1];
           }     
          // (шаг 2) удалить последнюю колонку.
          StringGrid->ColCount = col_count -1;
       }
       catch (...) {
           SendMessage(StringGrid->Handle, WM_SETREDRAW, true, 0);
       }
         SendMessage(StringGrid->Handle, WM_SETREDRAW, true, 0);
         // update (repaint) the shifted cols 
       RECT R = StringGrid->CellRect(0, Index);
         InflateRect(&R, StringGrid->Width, StringGrid->Height);
       InvalidateRect(StringGrid->Handle, &R, false);
}

стр. 5
P  R  O  M  S  I  T  E
Статьи по С++Builder 6
страницы: 1   2   3   4   5   6   7   8
страницы: 1   2   3   4   5   6   7   8

Для отображения Облака ссылок
необходим
Adobe Flash Player 9
или выше.