Need Assistance on OLEDragDrop and Drag methods
-
I have a solitaire game where I have 52 cards lined up in design view. I'm wondering (in design view) what to set the oledragmode, oledropmode, and dragmode elements to; automatic? manual? What's happening with my code below is that I only want 12 hearts cards to be dragged to blank card positions on the right of the screen. However, all the cards drag and all cards, including hearts cards can only drop onto the 13th blank card on the right. Not the 0 to 12. Should I write some code to set or clear the dragmodes and what do I do in design mode? I only want the first 12 cards of the 52 cards to be dragged; they are hearts cards and I want 12 blank cards on the right to be the hearts suit only. Pardon me; I'm new to this; Also Much appreciation in advance. Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) Dim HeartsIndex As Integer Image(0).Picture = Hearts(0).Picture Image(1).Picture = Hearts(1).Picture Image(2).Picture = Hearts(2).Picture Image(3).Picture = Hearts(3).Picture Image(4).Picture = Hearts(4).Picture Image(5).Picture = Hearts(5).Picture Image(6).Picture = Hearts(6).Picture Image(7).Picture = Hearts(7).Picture Image(8).Picture = Hearts(8).Picture Image(9).Picture = Hearts(9).Picture Image(10).Picture = Hearts(10).Picture Image(11).Picture = Hearts(11).Picture Image(12).Picture = Hearts(12).Picture For Index = 0 To 12 For HeartsIndex = 0 To 12 If Image1(Index).Picture = Hearts(HeartsIndex).Picture Then Hearts(HeartsIndex).Picture = Source(HeartsIndex).Picture Image1(Index).Drag vbEndDrag MsgBox ("You're right") Exit Sub Else Image1(Index).Drag vbCancel MsgBox ("You're Wrong") Exit Sub End If Next HeartsIndex Next Index End Sub
-
I have a solitaire game where I have 52 cards lined up in design view. I'm wondering (in design view) what to set the oledragmode, oledropmode, and dragmode elements to; automatic? manual? What's happening with my code below is that I only want 12 hearts cards to be dragged to blank card positions on the right of the screen. However, all the cards drag and all cards, including hearts cards can only drop onto the 13th blank card on the right. Not the 0 to 12. Should I write some code to set or clear the dragmodes and what do I do in design mode? I only want the first 12 cards of the 52 cards to be dragged; they are hearts cards and I want 12 blank cards on the right to be the hearts suit only. Pardon me; I'm new to this; Also Much appreciation in advance. Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single) Dim HeartsIndex As Integer Image(0).Picture = Hearts(0).Picture Image(1).Picture = Hearts(1).Picture Image(2).Picture = Hearts(2).Picture Image(3).Picture = Hearts(3).Picture Image(4).Picture = Hearts(4).Picture Image(5).Picture = Hearts(5).Picture Image(6).Picture = Hearts(6).Picture Image(7).Picture = Hearts(7).Picture Image(8).Picture = Hearts(8).Picture Image(9).Picture = Hearts(9).Picture Image(10).Picture = Hearts(10).Picture Image(11).Picture = Hearts(11).Picture Image(12).Picture = Hearts(12).Picture For Index = 0 To 12 For HeartsIndex = 0 To 12 If Image1(Index).Picture = Hearts(HeartsIndex).Picture Then Hearts(HeartsIndex).Picture = Source(HeartsIndex).Picture Image1(Index).Drag vbEndDrag MsgBox ("You're right") Exit Sub Else Image1(Index).Drag vbCancel MsgBox ("You're Wrong") Exit Sub End If Next HeartsIndex Next Index End Sub
I don't think there is a standard about whether or not you set a property at design time or if you do it in code. It's up to you. Sounds like you just need to play with the properties until you find what you are looking for. You need to make sure the properties are initially set when loading the form, which can be done either in the load event or set at design time. Then think about when these properties need to change during run time and code the proper events. Is this what you were asking?
-
I don't think there is a standard about whether or not you set a property at design time or if you do it in code. It's up to you. Sounds like you just need to play with the properties until you find what you are looking for. You need to make sure the properties are initially set when loading the form, which can be done either in the load event or set at design time. Then think about when these properties need to change during run time and code the proper events. Is this what you were asking?
Yes, and thank you. However, I need to gather more info. I'm still a bit confused. I know I'd like to set the properties at design time and set them to remain that way throughout the entire program. Here it is: 52 cards on left; 12 of which I ONLY want to match 12 cards on the right when dropped. 52 cards get randomized, and I pick out one by one those 12 cards and drop it on a spot on the right. It works. Now here is what is wrong: ALL the cards, including those 12 cards drop on the right; I was only allowing in my code in the IF statement that when one of the 12 cards of the heart suit on the left = the heart suit on the right, only those cards can be dropped, not every card of the other suits. Second problem. Only the last position Hearts(12) on the right is taking cards. The rest of the 12 position won't take any cards. Any idea on WHAT to set on those drag mode properties at design time? I've played around and have gotten nowhere. Thank you in advance