|
마우스 위치에 따라 이미지를 바꾸는 방법은 다소 무식하게 코딩하자면,
아래와 같습니다. shape객체를 폼에 하나 떨기고 테스트해보세요.
TForm1 *Form1;
bool Over;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Shape1MouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if (!Over) {
Over=true;
Shape1->Shape=stCircle;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if (Over) {
Over=false;
Shape1->Shape=stRectangle;
}
}
|