아래 소스와 같이 하니까 셀 1,1 3,3에 RED가 입혀지기는 하는데, 버튼으로 동작하게 하고, Grid 아무곳이나 클릭해도
색깔을 바꾸게 하고 싶고 또한 그 셀의 색깔을 확인하고 싶은데 방법이 있나요?
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
{if gdFocused in State then}
if (ACol >= StringGrid1.FixedCols) and (ARow >= StringGrid1.FixedRows) then
with (Sender as TStringGrid).Canvas do
begin
if (ARow = 1) and (ACol = 1)then Brush.Color := clRed;
if (ARow = 3) and (ACol = 3)then Brush.Color := clRed;
//else Brush.Color := clBlue ;
FillRect(Rect) ;
TextOut(Rect.Left, Rect.Top, StringGrid1.Cells[ACol,ARow]) ;
end;
end;
아무개 님이 쓰신 글 :
: StringGrid에서 셀마다 Color를 지정하고, 또한 셀마다 무슨 Color로 되어있는지 확인할 수 있나요?
: 안되면 되는 컴퍼넌트는 없을까요?
|