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;
		}

Forget it, I have found the problem by myself.... The code I have provided works perfectly...

I was just playing around with it, but in case you're interested http://www.codeproject.com/KB/cs/DraggableForm.aspx also works (you need to change the Point * (as it's old) to regular Points to get it to play nice.

Glad you found a solution

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.