|
둥이네 님이 쓰신 글 :
: void __fastcall TForm1::FFPanel9MouseMove(TObject *Sender,
: TShiftState Shift, int X, int Y)
: {
: //............................
: POINT pPos ;
: pPos.x = X;
: pPos.y = Y;
: GetCursorPos(&pPos);
:
: if (FindControl(WindowFromPoint(pPos)) == NULL)
: return ;
: TFFPanel *PanTest = (TFFPanel *)FindControl(WindowFromPoint(pPos));
:
: if( PanTest->Tag>0 ){
: RxSpeedButton->Left = PanTest->Left-2;
: RxSpeedButton->Top = PanTest->Top-2;
: xPoint = X;
: yPoint = Y;
: //.....................
: }
:
:
: 이렇게 된 부분을.... 중간에..TFFPanel *PanTest = (TFFPanel *)FindControl(WindowFromPoint(pPos));
: 윕부분까지를 따로 함수를 만들어서 빼낼려고 합니다.
: 이부분이 중복 되는 구간이 많아서 따로 뺄려고 하거등요..
:
:
: void __fastcall TForm1::FFPanel9MouseMove(TObject *Sender,
: TShiftState Shift, int X, int Y)
: {
: // ..........................
: TFFPanel *PanTest;
: FindPanel(*PanTest,X, Y);
: if( PanTest->Tag>0 ){
: RxSpeedButton->Left = PanTest->Left-2;
: RxSpeedButton->Top = PanTest->Top-2;
: xPoint = X;
: yPoint = Y;
:
:
:
: //...........................
: }
:
: void __fastcall TForm1::FindPanel(TFFPanel &PanTest,int X,int Y){
: POINT pPos ;
: pPos.x = X;
: pPos.y = Y;
: GetCursorPos(&pPos);
:
: if (FindControl(WindowFromPoint(pPos)) == NULL)
: return ;
:
: PanTest =(TFFPanel *)FindControl(WindowFromPoint(pPos));
: // Edit1->Text = PanTest->Tag ;
: }
:
: 이렇게 했는데..자꾸.. PanTest =(TFFPanel *)FindControl(WindowFromPoint(pPos));
: 이 부분에서 에러가 나네요...
: 함수를 어떻게 바꾸면 좋을지 몰라서 조언 부탁 드립니다. 아니면 처음부터 잘못 작성한건지..
: 어떻게 해야 할지..조언 부탁 드립니다.
void __fastcall TForm1::FFPanel9MouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
// ..........................
TFFPanel *PanTest;
FindPanel(&PanTest,X, Y);
if( PanTest->Tag>0 ){
RxSpeedButton->Left = PanTest->Left-2;
RxSpeedButton->Top = PanTest->Top-2;
xPoint = X;
yPoint = Y;
//...........................
}
void __fastcall TForm1::FindPanel(TFFPanel **PanTest,int X,int Y){
POINT pPos ;
pPos.x = X;
pPos.y = Y;
GetCursorPos(&pPos);
// if (FindControl(WindowFromPoint(pPos)) == NULL) return ;
*PanTest =(TFFPanel *)FindControl(WindowFromPoint(pPos));
// Edit1->Text = PanTest->Tag ;
}
OR
void __fastcall TForm1::FFPanel9MouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
// ..........................
TFFPanel *PanTest = FindPanel(X, Y);
if( PanTest->Tag>0 ){
RxSpeedButton->Left = PanTest->Left-2;
RxSpeedButton->Top = PanTest->Top-2;
xPoint = X;
yPoint = Y;
//...........................
}
TFFPanel * __fastcall TForm1::FindPanel(int X,int Y){
POINT pPos ;
pPos.x = X;
pPos.y = Y;
GetCursorPos(&pPos);
// if (FindControl(WindowFromPoint(pPos)) == NULL) return;
return (TFFPanel *)FindControl(WindowFromPoint(pPos));
// Edit1->Text = PanTest->Tag ;
}
|