Click here to Skip to main content
15,908,931 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: VB6 card game question Pin
riced9-May-09 6:27
riced9-May-09 6:27 
GeneralRe: VB6 card game question Pin
ymilan10-May-09 5:14
ymilan10-May-09 5:14 
GeneralRe: VB6 card game question Pin
riced11-May-09 5:45
riced11-May-09 5:45 
GeneralRe: VB6 card game question Pin
ymilan15-May-09 11:27
ymilan15-May-09 11:27 
GeneralRe: VB6 card game question Pin
riced18-May-09 6:11
riced18-May-09 6:11 
GeneralRe: VB6 card game question Pin
ymilan18-May-09 9:22
ymilan18-May-09 9:22 
GeneralRe: VB6 card game question Pin
ymilan2-Jun-09 14:26
ymilan2-Jun-09 14:26 
GeneralRe: VB6 card game question Pin
riced3-Jun-09 4:42
riced3-Jun-09 4:42 
ymilan wrote:
you think I should use dragover?


Not for dropping the image. As I said you should only be changing something like the background or border of the target to give user feedback. If you don't want to give feedback do nothing.

To see why imagine you have a form with four images.
On the left is an image called theShape; on the right are three images called BoxA, BoxB and BoxC.
Imagine that the user selects theShape image and drags it to the right of the form (i.e.they are holding the mouse button down).
Suppose they drag the shape over the BoxA image. This will trigger the BoxA_DragOver event with state = 0. What should this event do? One option is nothing, so you don't write any code for the event. Another option is to change the border or color of the BoxA image so the user knows that theShape is over BoxA. What you should not do is set BoxA image to theShape image. The user has not released the mouse button so they don't want theShape to be in BoxA.
If the user does release the mouse button then the BoxA_DragDrop event is triggered. That is when you might want to set BoxA image to theShape so that the code to do so should be in the BoxA_DragDrop event.
Suppose the user drags theShape over the BoxA image (without releasing the mouse button) and then drags it over the BoxB image. Two things happen. First the BoxA_DragOver event is triggered with state = 1; then the BoxB_DragOver event is triggered with state = 0. In this case the BoxA_DragDrop could set the border or color back to their original values and the BoxB_DragDrop could change the border or color of BoxB image. Again, BoxB_DragOver should not set the BoxB image to theShape image. The user might continue the drag so it goes over BoxC.

If you imagine that the images for the boxes are much larger than theShape image, then as the user drags theShape around in a box image the DragOver event is triggered continuously with state = 2. In most cases that does not matter so the code does nothing.

This all means that the typical code for a DragOver event will be something like:
If State = 0 Then
   'Do something like change border or color of the box
   'You simply want to make user aware of where theShape has been dragged too
Else
   If State = 1 Then
      'Set the border/color of the box back to original value
   Else 'State = 2
      'Do nothing - they are moving around within the box
   End If
End If


Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis

GeneralRe: VB6 card game question Pin
ymilan3-Jun-09 5:10
ymilan3-Jun-09 5:10 
GeneralRe: VB6 card game question Pin
ymilan3-Jun-09 6:28
ymilan3-Jun-09 6:28 
GeneralRe: VB6 card game question Pin
riced3-Jun-09 8:06
riced3-Jun-09 8:06 
GeneralRe: VB6 card game question Pin
ymilan3-Jun-09 9:02
ymilan3-Jun-09 9:02 
GeneralRe: VB6 card game question Pin
riced3-Jun-09 10:04
riced3-Jun-09 10:04 
GeneralRe: VB6 card game question Pin
ymilan3-Jun-09 11:54
ymilan3-Jun-09 11:54 
GeneralRe: VB6 card game question Pin
ymilan4-Jun-09 2:47
ymilan4-Jun-09 2:47 
GeneralRe: VB6 card game question Pin
ymilan2-Jun-09 14:29
ymilan2-Jun-09 14:29 
GeneralRe: VB6 card game question Pin
ymilan2-Jun-09 23:24
ymilan2-Jun-09 23:24 
QuestionAttached to Events Pin
Thayhor6-May-09 8:55
Thayhor6-May-09 8:55 
AnswerRe: Attached to Events Pin
Dave Kreskowiak6-May-09 9:05
mveDave Kreskowiak6-May-09 9:05 
GeneralRe: Attached to Events Pin
Thayhor6-May-09 11:13
Thayhor6-May-09 11:13 
GeneralRe: Attached to Events Pin
Dave Kreskowiak6-May-09 15:30
mveDave Kreskowiak6-May-09 15:30 
GeneralRe: Attached to Events Pin
Thayhor6-May-09 21:05
Thayhor6-May-09 21:05 
GeneralRe: Attached to Events Pin
Dave Kreskowiak7-May-09 1:49
mveDave Kreskowiak7-May-09 1:49 
Questioncheckedlistbox in vb.net Pin
Pankaj-codeproject6-May-09 8:46
Pankaj-codeproject6-May-09 8:46 
AnswerRe: checkedlistbox in vb.net Pin
Dave Kreskowiak6-May-09 9:15
mveDave Kreskowiak6-May-09 9:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.