I have this System::Windows::Forms::Panel that I want to enable so that if the user click and drags the mouse drags the window around to.
Can I do this? Do i have to implement multiple events?
I suggest you should try to call Control.MouseDown Event and Control.MouseMove Event
Here is my code, I suggest you could refer to :
Point pt;
private: System::Void panel1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
Point mouseDownLocation = Point(e->X, e->Y);
pt = Cursor->Position;
}
private: System::Void panel1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e)
{
if (e->Button == System::Windows::Forms::MouseButtons::Left)
{
int px = Cursor->Position.X - pt.X;
int py = Cursor->Position.Y - pt.Y;
panel1->Location = System::Drawing::Point(panel1->Location.X + px, panel1->Location.Y + py);
pt = Cursor->Position;
}