|
-
Drag and Drop Problem
Hi,
I'm having some problems implementing drag and drop in my vb app. I am
trying to implement a drop and drop operation so that I can drag a bunch
of selected rows from a datagrid into a TreeView control. Right now, I am
tackling the problem like this:
Private Sub dataBusinessList_MouseDown(ByVal sender As Object, ByVal e
Dim dEffect As DragDropEffects
If e.Button = MouseButtons.Left Then
With dataBusinessList
.DoDragDrop("Xin", DragDropEffects.Move)
End With
End If
End Sub
Then in the treeview,
Private Sub tvwCategories_DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Allow drop.
e.Effect = DragDropEffects.Move
Else
' Do not allow drop.
e.Effect = DragDropEffects.None
End If
End Sub
Private Sub tvwCategories_DragDrop
MsgBox(e.Data.GetData(DataFormats.Text).ToString)
End Sub
The function headers have been shortened I'm running into a couple of
problems on the datagrid side. The datagrid allows you to click and drag
to select contiguous rows. When I implemented this code, it seems to interfere
with that native operation, which is no surprise. But still, I'd like to
find a solution to it, if there is one. A second problem is that if you
place your mouse approximately where the grid lines divide one row from another
row, you can click and then resize the rows. However, when I implemented
my drag and drop code, if I happen to click on the gridline, I will initiate
a resize operation for that row, but I cannot get out of it by releasing
the mouse button. I have to right click for it to end the resize operation.
Is there anyway around these problems?
I was actually toying with the idea of testing to see what the current mouse
cursor is in the MouseDown event. If it's change to a Resize type cursor,
then don't call DoDragDrop. But I can't seem to figure out how to find out
what the current mouse cursor is. Any help is greatly appreciated. Thanks
so much.
Xin Li
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks