hazard 님이 쓰신 글 :
: procedure TfrmTSTS_S_13_003.OnGridRowChanging(Sender: TObject;
: OldRow, NewRow: Integer; var Allow: Boolean);
: var
: Grid: TAdvColumnGrid;
: I, C, T, R: Integer;
: ORow: Array [0..2] of Integer;
: NRow: Array [0..2] of Integer;
: begin
: if Sender is TAdvColumnGrid then begin
: Grid := TAdvColumnGrid(Sender);
: for I := 0 to Grid.VisibleColCount + Grid.FixedCols - 1 do begin
: C := Grid.LeftCol + I;
: R := OldRow - Grid.FixedRows;
: if (R mod 3) = 0 then begin
: ORow[0] := OldRow;
: ORow[1] := OldRow + 1;
: ORow[2] := OldRow + 2;
: end
: else if (R mod 3) = 1 then begin
: ORow[0] := OldRow - 1;
: ORow[1] := OldRow;
: ORow[2] := OldRow + 1;
: end
: else begin
: ORow[0] := OldRow - 2;
: ORow[1] := OldRow - 1;
: ORow[2] := OldRow;
: end;
: Grid.RepaintCell(C, ORow[0]);
: Grid.RepaintCell(C, ORow[1]);
: Grid.RepaintCell(C, ORow[2]);
: R := NewRow - Grid.FixedRows;
: if (R mod 3) = 0 then begin
: NRow[0] := NewRow;
: NRow[1] := NewRow + 1;
: NRow[2] := NewRow + 2;
: end
: else if (R mod 3) = 1 then begin
: NRow[0] := NewRow - 1;
: NRow[1] := NewRow;
: NRow[2] := NewRow + 1;
: end
: else begin
: NRow[0] := NewRow - 2;
: NRow[1] := NewRow - 1;
: NRow[2] := NewRow;
: end;
: Grid.RepaintCell(C, NRow[0]);
: Grid.RepaintCell(C, NRow[1]);
: Grid.RepaintCell(C, NRow[2]);
: end;
: end;
: end;
위 코드는 대충 다음과 같이 변환 되겠네요
void __fastcall TfrmTSTS_S_13_003::OnGridRowChanging(TObject *Sender , int OldRow,int NewRow, bool &Allow)
{
TAdvColumnGrid *Grid;
int I,C,T,R;
int ORow[3],NRow[3];
Grid = (TAdvColumnGrid *)Sender;
for( I = 0 ;i<=( Grid->VisibleColCount + Grid->FixedCols - 1);I++)
{
C = Grid->LeftCol + I;
R = OldRow - Grid->FixedRows;
if( (R % 3) == 0 ) {
ORow[0] = OldRow;
ORow[1] = OldRow + 1;
ORow[2] = OldRow + 2;
}
else if( (R % 3) == 1 ) {
ORow[0] = OldRow - 1;
ORow[1] = OldRow;
ORow[2] = OldRow + 1;
}
else {
ORow[0] = OldRow - 2;
ORow[1] = OldRow - 1;
ORow[2] = OldRow;
};
Grid->RepaintCell(C, ORow[0]);
Grid->RepaintCell(C, ORow[1]);
Grid->RepaintCell(C, ORow[2]);
R = NewRow - Grid->FixedRows;
if( (R % 3) == 0 ) {
NRow[0] = NewRow;
NRow[1] = NewRow + 1;
NRow[2] = NewRow + 2;
}
else if( (R % 3) == 1 ) {
NRow[0] = NewRow - 1;
NRow[1] = NewRow;
NRow[2] = NewRow + 1;
}
else {
NRow[0] = NewRow - 2;
NRow[1] = NewRow - 1;
NRow[2] = NewRow;
};
Grid->RepaintCell(C, NRow[0]);
Grid->RepaintCell(C, NRow[1]);
Grid->RepaintCell(C, NRow[2]);
};
}
그럼..