StringGrid > Events TAB에 보면 아래와 같은 procedure 가 있는데, 호출을 안해도 무한으로 그냥 돌네요^^
procedure TMainForm.TStringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
전 전역변수로 boolean array를 잡아서 StringGrid 셀과 같은 영역을 잡았어요, 그래서 boolean array 변수값을
true 만들면 그곳( boolean array 변수값에 대당하는 영역)에 clBlack의 Color가 들어가도록 위 procedure로 구성
하니까 잘 되더군요.
다른 더 좋은 방법이 있으면 조언 좀 해 주세요^^
var arrBL: array[0..10,0..10] of Boolean;
procedure TMainForm.TStringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
if(arrBL[ACol,ARow] = true) then
begin
StringGrid.Canvas.Brush.Color := clBlack;
StringGrid.Canvas.FillRect(Rect);
StringGrid.Canvas.TextOut(Rect.Left, Rect.Top, Grid122x16.Cells[ACol,ARow]) ;
end else
begin
StringGrid.Canvas.Brush.Color := clWindow;
StringGrid.Canvas.FillRect(Rect);
StringGrid.Canvas.TextOut(Rect.Left, Rect.Top, Grid122x16.Cells[ACol,ARow]) ;
end;
end;
end;
procedure TMainForm.TestBnt;
begin
arrBL[1,1] := true;
end;
아무개 님이 쓰신 글 :
: StringGrid에서 셀마다 Color를 지정하고, 또한 셀마다 무슨 Color로 되어있는지 확인할 수 있나요?
: 안되면 되는 컴퍼넌트는 없을까요?
|