`

BCB窗口任意拖动

    博客分类:
  • bcb
阅读更多

void __fastcall TForm1::Image1MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
   iX = X;
   iY = Y;
   bMouseDown = true;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Image1MouseUp(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
    bMouseDown = false;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Image1MouseMove(TObject *Sender, TShiftState Shift,
      int X, int Y)
{
    if(bMouseDown)
        {
           // DoubleBuffered   =   True;
            Form1->Left   =   Form1->Left   +   X   -   iX;
            Form1->Top     =   Form1->Top   +   Y   -   iY;
             Edit1->Text = Form1->Left + X - iX;
             Edit2->Text = Form1->Top + Y - iY;

        }
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics