MouseDrag?

Hello -
I have a bunch of custom controls named timeSlot that are just little pannels that the color can be changed.  In another control (timeTable), a bunch of timeSlots are added programatically.  I am trying to create the effect that when the user clicks on one of the timeSlots in the timeTable, that slot's color changes and all the other slots that the mouse is dragged over change as well.

This effect  can be seen here -
http://mischedule.com/v20/MISchedule.php term=w06
(click the times button, and select the custom radio button)

I have tried to do this every way I see possible but cant accomplish it.
The problem seems to be when I drag off one control to another, the other doesnt realize that the mouse is moving or that the mouse button is down.

Can anybody help me

Thanks a lot!
Zach


Answer this question

MouseDrag?

  • Henry Zhang

    But if I do that the event doesnt get passed from one control to the other, it counts as a kind of drag on the one control only.

    thanks

  • Austin Ehlers

    The following code is nowhere complete but hopefully it gives yiou an idea of how to accomplish you task


    DIm TimeSLotColorChange as Boolean
    Dim TheSlot as timeSlot

    Private Sub timeSlots_Click()
       TimeSlotColorChange = True
       timeSLot.BackColor = Color.Green
    End Sub

    Private Sub Form_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove

    If e.Button = Windows.Forms.MouseButtons.Left And TimeSlotColorChange Then

    If e.X > timeSlot.Location.X AndAlso e.X < timeSlot.Location.X + timeSlot.Width Then

    If e.Y > timeSlot.Top AndAlso e.Y < timeSlot.Top + timeSlot.Height Then

    DoYourChangeOf(ColorHere)

    'you will have to match up the location of the timeslot to change with the mouse location
    End
    If

    End If

    End If

    End Sub

     

    Private Sub Form2_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp

    If TimeSlotColorChange Then

    TimeSlotColorChange = False

    End If

    End Sub

     





  • A_M

    I've tried something like that but my problem is that mousemove only works for me when the mouse is over the form, not it's child controls.

    Any suggestions

    thanks

  • boone10

    use the mouse move events of the controls then!

  • MouseDrag?