c++/cli で imageをmouseでdrag gcnewしないのがミソ
private: System::Void pictureBox1_MouseDown(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
bDrag = true;
ptStart = e->Location;
}
private: System::Void pictureBox1_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
bDrag = false;
}
private: System::Void pictureBox1_MouseMove(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
if (bDrag) {
Point p = Point(e->Location.X - ptStart.X, e->Location.Y - ptStart.Y);
panel1->AutoScrollPosition = Point(
-(panel1->AutoScrollPosition.X) - p.X,
-(panel1->AutoScrollPosition.Y) - p.Y
);
}
}