Exemple #1
0
        void lst_L_DragDrop(object sender, DragEventArgs e)
        {
            lstBox_To = sender as DevExpress.XtraEditors.ListBoxControl;

            Point newPoint = new Point(e.X, e.Y);

            newPoint = lstBox_To.PointToClient(newPoint);

            int selectedIndex = lstBox_To.IndexFromPoint(newPoint);

            if (lstBox_From.Equals(lstBox_To))
            {
                return;
            }

            lstBox_From.SelectedItems.ToList().ForEach(a =>
            {
                if (!lstBox_To.Items.Contains(a))
                {
                    lstBox_To.Items.Add(a);
                }
                if (lstBox_From.Items.Contains(a))
                {
                    lstBox_From.Items.Remove(a);
                }
            });

            lstBox_To.SortOrder = SortOrder.Ascending;
        }
Exemple #2
0
        void lst_L_MouseDown(object sender, MouseEventArgs e)
        {
            lstBox_From = sender as DevExpress.XtraEditors.ListBoxControl;

            p = new Point(e.X, e.Y);

            int selectedIndex = lstBox_From.IndexFromPoint(p);

            if (selectedIndex == -1)
            {
                p = Point.Empty;
            }
        }
Exemple #3
0
 private void listBox1_DragDrop(object sender, DragEventArgs e)
 {
     DevExpress.XtraEditors.ListBoxControl          lb    = sender as DevExpress.XtraEditors.ListBoxControl;
     DevExpress.XtraTreeList.TreeListMultiSelection nodes = GetDragNodes(e.Data);
     if (nodes != null)
     {
         int ind = lb.IndexFromPoint(lb.PointToClient(new Point(e.X, e.Y)));
         for (int i = 0; i < nodes.Count; i++)
         {
             string dragString = GetStringByNode(nodes[i]);
             if (ind == -1)
             {
                 lb.Items.Add(dragString);
             }
             else
             {
                 lb.Items.Insert(ind, dragString);
             }
         }
     }
 }