PDA

Click to See Complete Forum and Search --> : drag canvas


rene12358
Feb 3rd, 2009, 10:46 AM
Hi,

My application contains 3 tab. Everything including tabcontrol, canvas, etc is done using vb code. And the dragging of canvas is in the 2nd tab.

I used this website as a reference for the drag canvas.
http://blogs.msdn.com/marcelolr/archive/2006/03/02/542641.aspx

There is no error in my application. But when I debug my application, I could not click on the 2nd and 3rd tab.

But when I comment the coding below, I can click on the 2nd and 3rd tab:

Private Sub MyCanvas_PreviewMouseLeftButtonDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs) Handles MyCanvas.PreviewMouseLeftButtonDown
If MyCanvas Is e.Source Then
Exit Sub
End If

m_IsDown = True
m_StartPoint = e.GetPosition(MyCanvas)
m_OriginalElement = e.Source
MyCanvas.CaptureMouse()
e.Handled = True
End Sub

Anyone know how to solve it...? I'm using WPF application.

Thanks

vbNeo
Feb 5th, 2009, 09:18 AM
Hmm... That does sound rather strange. Have you tried tieing a mouseclick event to the tabcontrol to see if it fires?

Might be because you've captured the mouse in your canvas, and somehow the routed event never reaches the tab control - it does seem unlikely though.

techgnome
Feb 5th, 2009, 09:40 AM
Actually, I think it's this:
e.Handled = True

By telling the system it's been handled, if I remember right, that prevents any further processing on it... which cancels any further event calls.

-tg

vbNeo
Feb 5th, 2009, 09:44 AM
Oh yeah, I think you're right - that stops the event from being routed any further.