Click here to Skip to main content
15,910,603 members
Home / Discussions / C#
   

C#

 
GeneralClipboard and IStorage Pin
Oleksandr Kucherenko20-Oct-03 0:12
Oleksandr Kucherenko20-Oct-03 0:12 
GeneralRe: Clipboard and IStorage Pin
Heath Stewart20-Oct-03 6:16
protectorHeath Stewart20-Oct-03 6:16 
GeneralRe: Clipboard and IStorage Pin
Oleksandr Kucherenko20-Oct-03 21:09
Oleksandr Kucherenko20-Oct-03 21:09 
GeneralRe: Clipboard and IStorage Pin
Heath Stewart21-Oct-03 3:01
protectorHeath Stewart21-Oct-03 3:01 
GeneralRemoting on .NET Framework 1.1 Pin
KC Ooi19-Oct-03 23:14
KC Ooi19-Oct-03 23:14 
GeneralRe: Remoting on .NET Framework 1.1 Pin
Jeffry van de Vuurst20-Oct-03 1:51
Jeffry van de Vuurst20-Oct-03 1:51 
GeneralTake the "real" time an application has been used Pin
Braulio Dez19-Oct-03 23:05
Braulio Dez19-Oct-03 23:05 
GeneralRe: Take the "real" time an application has been used Pin
Marc Clifton20-Oct-03 1:13
mvaMarc Clifton20-Oct-03 1:13 
GeneralRe: Take the "real" time an application has been used Pin
Braulio Dez20-Oct-03 2:20
Braulio Dez20-Oct-03 2:20 
GeneralRe: Take the "real" time an application has been used Pin
Corinna John20-Oct-03 1:35
Corinna John20-Oct-03 1:35 
GeneralRe: Take the "real" time an application has been used Pin
Braulio Dez20-Oct-03 2:21
Braulio Dez20-Oct-03 2:21 
GeneralRe: Take the "real" time an application has been used Pin
Andrew Torrance22-Oct-03 22:33
Andrew Torrance22-Oct-03 22:33 
GeneralTables in a DataSet Pin
Mazdak19-Oct-03 22:44
Mazdak19-Oct-03 22:44 
GeneralRe: Tables in a DataSet Pin
Heath Stewart20-Oct-03 5:29
protectorHeath Stewart20-Oct-03 5:29 
Generalgui behavior Pin
Roger Alsing19-Oct-03 22:30
Roger Alsing19-Oct-03 22:30 
GeneralRe: gui behavior Pin
Heath Stewart20-Oct-03 5:32
protectorHeath Stewart20-Oct-03 5:32 
GeneralRe: gui behavior Pin
DesertLarry21-Oct-03 5:04
DesertLarry21-Oct-03 5:04 
GeneralDll free problem Pin
andyniyong19-Oct-03 22:22
andyniyong19-Oct-03 22:22 
GeneralRe: Dll free problem Pin
leppie20-Oct-03 7:12
leppie20-Oct-03 7:12 
GeneralRe: Dll free problem Pin
andyniyong21-Oct-03 16:04
andyniyong21-Oct-03 16:04 
Questionneed help... Listview drag drop algorithm? Pin
azusakt19-Oct-03 22:04
azusakt19-Oct-03 22:04 
AnswerRe: need help... Listview drag drop algorithm? Pin
Heath Stewart20-Oct-03 5:38
protectorHeath Stewart20-Oct-03 5:38 
GeneralRe: need help... Listview drag drop algorithm? Pin
azusakt21-Oct-03 18:22
azusakt21-Oct-03 18:22 
thanks for your reply, Stewart.
<small>Heath Stewart wrote:</small>
 myListView.Items.Insert(item.Index + 1, draggedItem);


my codes are little same as that you provided,however, there is a problem that it will always insert the new item below the target item.

My code :
private void List_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
    Point cp = List.PointToClient(new Point(e.X, e.Y));
    ListViewItem dragToItem = List.GetItemAt(cp.X, cp.Y);
    int num = List.SelectedItems.Count;
    int locationIndex = dragToItem.Index;



    for(int i=0; i<<num; i++)
    {
        ListViewItem dragItem = List.SelectedItems[i];

        ListViewItem insertItem = (ListViewItem)dragItem.Clone();
        List.Items.Insert(locationIndex, insertItem);
        locationIndex++;
    }

    foreach(ListViewItem olditem in List.SelectedItems)
    {
        List.Items.Remove(olditem);
    }

}


I felt some part of my code can be improved, but could you check what's worng with me?
GeneralRe: need help... Listview drag drop algorithm? Pin
Heath Stewart21-Oct-03 18:36
protectorHeath Stewart21-Oct-03 18:36 
GeneralRe: need help... Listview drag drop algorithm? Pin
azusakt21-Oct-03 22:20
azusakt21-Oct-03 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.