|
저 부분때문에...결국 MarkBlock 배열이 마지막 한번밖에 체크가 안되는군요...
저 if 문대신 그냥 for 문만 돌리셔야 MarkBlock이 모두 체크가 되겠지요..
gdSelected The cell is currently selected.
gdFocused The cell has input focus.
gdFixed The cell is in the fixed region of the grid.
초보 님이 쓰신 글 :
: void __fastcall TForm1::StringGrid1MouseDown(TObject *Sender,
: TMouseButton Button, TShiftState Shift, int X, int Y)
: {
: StringGrid1->MouseToCell(X,Y,iCol,iRow);
: if(Shift.Contains(ssLeft)) {
: MarkBlock[iRow][iCol] = 1; //--------저장부분 1.
: preCol = iCol;
: preRow = iRow;
: }
: }
: void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
: int ARow, TRect &Rect, TGridDrawState State)
: {
: if(State.Contains(gdSelected)) { <<========================= 이부분때문에...
: for(int row = 0; row < StringGrid1->RowCount; row++) {
: for(int col = 0; col < StringGrid1->ColCount; col++) {
: if(MarkBlock[row][col] == 1) {
: StringGrid1->Canvas->Brush->Color = clBackground;
: StringGrid1->Canvas->FillRect(Rect);
: }
: }
: }
: }
: if(State.Contains(gdFocused))
: StringGrid1->Canvas->DrawFocusRect(Rect);
: }
: 위에서 마우스 버튼을 클릭할때마다 크릭되는 부분은 파란색으로 표시하고
: 저장부분 1.와 같이 저장합니다.
: 그러나, 하번이나 또는 맨 마지막에 표현한 부분만 표시되고 그 전에 표시한 부분은
: 저장부분 1의 배열에는 저장되지만 눈으로는 표시할수 없습니다,
: 어떻게 하면 크릭한 셀이 누적되게 표시하고, 또 표시한 부분을 또 원 상태로 바꿀 수 있을까여?
: 잘 모르겠습니다.
|