|
그리드로 버튼을 208개 생성 했습니다.
마우스로 셀을 클릭하면 힌색에서 빨강으로 바뀌고....다시 클릭하면 빨강에서 힌색으로 바뀌게....
그리고....제가 클릭한 건....모두 빨강으로 바뀌게 할수 있는 방법 업나요....
셀이 하나 밖에 빨강으로 안되네요.....하나 클릭하고....다른거 클릭하면 다른곳으로 넘어가 버림.
//---------------------------------------------------------------------------
MarkBlock[13][16];
int xxx;
int preCol, preRow;
void __fastcall TForm1::aaaMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
String str;
long iCol, iRow;//,preCol,preRow;
aaa->MouseToCell(X,Y,iCol,iRow);
if(Shift.Contains(ssLeft)) {
Memo1->Lines->Add(""+AnsiString((int)iRow)+"," + AnsiString((int)iCol));
// str = ""+AnsiString((int)iRow)+"," + AnsiString((int)iCol);
preCol = iCol;
preRow = iRow;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::aaaDrawCell(TObject *Sender, int ACol, int ARow,
TRect &Rect, TGridDrawState State)
{
if ( ACol == preCol && ARow == preRow )
{
Memo1->Lines->Add("ccc");
aaa->Canvas->Brush->Color = clRed;
aaa->Canvas->Pen->Color = clBlack;
aaa->Canvas->Font->Color = clBlack;
}
if(State.Contains(gdFocused)) {
aaa->Canvas->DrawFocusRect(Rect);
}
//--가운데 정렬 텍스트
unsigned oldalign = SetTextAlign(aaa->Canvas->Handle, TA_CENTER);
aaa->Canvas->TextRect(Rect, (Rect.Right+Rect.Left)/2, Rect.Top+2,
aaa->Cells[ACol][ARow]);
SetTextAlign(aaa->Canvas->Handle, oldalign);
//-----
}
//---------------------------------------------------------------------------
|