Which event should code go to restrict areas where a picture box is dropped on a form

I am trying to make a card game in a windows form. I want to check the image string name in the picture box before it is and dropped using the mouse onto a pile of cards on the form. I also only want the card to be dropped in a certain area of the form only. I'm not sure which mouse event to do this in. I appreciate any help I can get with this problem. thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

private: System::Void player1card1_MouseDown(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
	if (e->Button == System::Windows::Forms::MouseButtons::Left)
	{
		dragging = true;
		currentX = e->X;
		currentY = e->Y;
	}
}
private: System::Void player1card1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {

	if (dragging) {
		player1card1->BringToFront();
		player1card1->Top = player1card1->Top + (e->Y - currentY);
		player1card1->Left = player1card1->Left +
                (e->X - currentX);		
		
	}	
}
private: System::Void player1card1_MouseUp(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
	
		 dragging = false;
}
private: System::Void player1card1_MouseHover(System::Object^  sender, System::EventArgs^  e) {
	
	player1card1->Cursor = Cursors::Hand;
}
private: System::Void player1card1_MouseLeave(System::Object^  sender, System::EventArgs^  e) {
	Cursor = Cursors::Arrow;
}
private: System::Void player1card1_DragEnter(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
	
}
private: System::Void player1card1_Move(System::Object^  sender, System::EventArgs^  e) {
	
}

Last edited on
Topic archived. No new replies allowed.