Hello,
I'm trying to make draggable a borderless form developed using Visual C++.
How ever, I'm not having look with it, and I had been unable to find an example about how to do it around the web.
This is the code I'm using currently, and which is not working. (Even when the C# version of the same code works perfectly).
Any idea? Thank you in advance for the help!
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e)
{
this->dragging = false;
}
private: System::Void Form1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
this->dragging = true;
this->offset = Point(e->X, e->Y);
}
private: System::Void Form1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (this->dragging)
{
Point currentScreenPos = PointToScreen(e->Location);
Location = Point(currentScreenPos.X - this->offset.X, currentScreenPos.Y - this->offset.Y);
}
}
private: System::Void Form1_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
this->dragging = false;
}