PDA

Click to See Complete Forum and Search --> : drag canvas/usercontrol...?


rene12358
Feb 7th, 2009, 07:16 AM
Hi,

I use the website below for drag and drop canvas:
http://blogs.msdn.com/marcelolr/archive/2006/03/02/542641.aspx

I have a textbox, button and user control in my application. The user control consists of a label. When the user type text on the textbox and click on the button, the user control containing the text in the textbox will appear.
I use the website above for drag and drop the user control but it does not work. But it works if it is not a user control. So does it means drag and drop a user control is different from canvas...? And is there any solution for it...? I'm using WPF application

Below is a small portion of my coding:

Dim test As New UserControl3

Private Sub DragStarted2()

m_IsDragging2 = True

m_OriginalLeft2 = Canvas.GetLeft(test.textLabel)
m_OriginalTop2 = Canvas.GetTop(test.textLabel)
m_OriginalRight2 = Canvas.GetLeft(test.textLabel)
m_OriginalBottom2 = Canvas.GetTop(test.textLabel)
m_OverlayElement2 = New Rectangle()
m_OverlayElement2.Width = m_OriginalElement2.RenderSize.Width
m_OverlayElement2.Height = m_OriginalElement2.RenderSize.Height
newCanvas.Children.Add(m_OverlayElement2)

End Sub

Thanks

chris128
Feb 9th, 2009, 06:48 AM
Is this the same question as: http://www.vbforums.com/showthread.php?t=556276 ?

rene12358
Feb 9th, 2009, 11:55 AM
It is not the same question. This thread is about dragging and dropping of canvas/user control. That thread is about not able to click on the tab control

Hamish
Feb 9th, 2009, 03:26 PM
If it's only a label, why are you using a custom control?

rene12358
Feb 10th, 2009, 04:39 AM
Its my project requirement

Hamish
Feb 10th, 2009, 04:50 AM
OK. Why is it a requirement? :confused:
What is the problem exactly? Do you get an error message? Have you placed breakpoints at crucial places to see if your events are firing as expected?