Results 1 to 4 of 4

Thread: drag canvas

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2009
    Posts
    32

    drag canvas

    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/arch...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

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: drag canvas

    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.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: drag canvas

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994

    Re: drag canvas

    Oh yeah, I think you're right - that stops the event from being routed any further.
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width