StringGrid , , . . . , , . . , , :
AnsiString Cells [int Acol][int ARow] | , ACol ARow |
TStrings* Cols[int Index] | , Index |
TStrings* Rows[int Index] | , Index |
TObject* Object [int ACol][int ARow] | , , AColARow |
. , TStrings.
ColCount RowCount , FixedCols FixedRows − () . FixedColor.
Options − goEditing − .
StringGrid - , . Col Row .
StringGrid OnSelectCell, . ACol ARow ( ) CanSelect − . , false.
StringGrid .
1. .
2. , Caption , − Close();
. , 10.
3. . , , .
4. − CSpinEdit1 ( ). MaxValue 10, MinValue − 0, Value − 3.
5. CSpinEdit1 StringGrid1 ( ), − , CSpinEdit2 , .
|
|
6. , 1- ,
int i,j;
Caption="";
StringGrid3->RowCount=0;
StringGrid3->ColCount=0;
StringGrid3->Cells[0][0]="";
StringGrid1->RowCount=CSpinEdit1->Value;
StringGrid1->ColCount=CSpinEdit2->Value;
for(i=0;i<StringGrid1->RowCount;i++)
for(j=0;j<StringGrid1->ColCount;j++)
StringGrid1->Cells[j][i]=IntToStr(random(101)-50);
7. StringGrid1 : FixedCols − 0, FixedRows − 0, goEditing Options − false. .
8. , goEditing Options StringGrid2 true, 2- ,
Caption="";
StringGrid3->RowCount=0;
StringGrid3->ColCount=0;
StringGrid3->Cells[0][0]="";
StringGrid2->RowCount=CSpinEdit3->Value;
StringGrid2->ColCount=CSpinEdit4->Value;
9. , . ( -) , − ,
int i,j,k,z;
if(StringGrid1->ColCount!= StringGrid2->RowCount){
Caption=" 1- 2- !";
return;}
StringGrid3->RowCount=CSpinEdit1->Value;
StringGrid3->ColCount=CSpinEdit4->Value;
for(i=0;i<StringGrid1->RowCount;i++)
for(j=0;j<StringGrid2->ColCount;j++){
z=0;
for(k=0;k<StringGrid1->ColCount;k++)
z+=StrToInt(StringGrid1->Cells[k][i])*
StrToInt(StringGrid2->Cells[j][k]);
StringGrid3->Cells[j][i]= IntToStr(z);
}
StringGrid3 , StringGrid1.
10. . . 2- . - . , . - -.
11. .