示例#1
0
        private void ListBoxParams_MouseDown(object sender, MouseEventArgs e)
        {
            int index = ListBoxParams.IndexFromPoint(e.Location);

            if (index != ListBox.NoMatches)
            {
                ListBoxParams.SelectedIndex = index;
                ListeBoxParams_SelectionChanged(null, null);
            }

            if (e.Button == MouseButtons.Right)
            {
                if (index != ListBox.NoMatches)
                {
                    ParamContextMenuListBox.Show(Cursor.Position);
                    ParamContextMenuListBox.Visible = true;
                }
                else
                {
                    ParamContextMenuListBox.Visible = false;
                }
            }
            else if ((e.Button == MouseButtons.Left) && (index != ListBox.NoMatches))
            {
                ListBoxParams.DoDragDrop(ListBoxParams.SelectedItem, DragDropEffects.Move);
            }
        }
示例#2
0
        private void ListBoxParams_DragDrop(object sender, DragEventArgs e)
        {
            System.Drawing.Point point = ListBoxParams.PointToClient(new System.Drawing.Point(e.X, e.Y));
            int To = ListBoxParams.IndexFromPoint(point);

            if (To < 0)
            {
                To = ListBoxParams.Items.Count - 1;
            }

            String data = (String)e.Data.GetData(typeof(String));
            int    From = ListBoxParams.Items.IndexOf(data);

            if (To == From)
            {
                return;
            }

            modifParam = true;
            _DicParam.Move(From, To);
            modifParam = false;

            SauverFichier();
        }