|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
having trouble with drag-n-drop of multiple itemsThe SelectionMode is FullRowSelect, so when I click, the whole row gets selected, not just cells. What I'd like to do is select rows 1, 3 and 5 (by control-clicking) and then click one more time, and drag all three rows. The problem that occurs is that when I do that last click (to perform the drag) all the rows unhilite, and only the row that I clicked on stays hilited. This is not desirable behavior, obviously. I'd really like my DataGridView to do drags the same way that Outlook or Windows Explorer (or any program that has a list of things like this). But I can't seem to find the right way to do this. If I'm just dragging one row, then this works fine, but I need to support dragging multiple rows. Thanks for any help in this matter, -Dan. P.S. - I've been a programmer for many years, but I'm a relative newbie to VB. Try deriving the DataGridView and overriding OnMouseDown to start your
drag if you are over a seelcted row. Public Class MyDataGridView Inherits DataGridView Protected Overrides Sub OnMouseDown(e As MouseEventArgs) Dim hti As HitTestInfo = Me.HitTest(e.X, e.Y) If Me.SelectedRows.Contains(Me.Rows(hti.RowIndex)) Then 'Not calling the baseclass prevents unselecting the selected rows 'Start your drag here Else MyBase.OnMouseDown(e) End If End Sub 'OnMouseDown End Class 'MyDataGridView ============================== Clay Burch Syncfusion, Inc.
Refresh only the CurrentRow of a DataGridView?
Binding User Settings to Controls How can I reference a parent objects properties? Cannot sort DataGridView bound to array Versioning problem Relection question ListBox.DataSource clears exisiting items SMO Disconnect Getting info from excel. CheckboxList query |
|||||||||||||||||||||||