private void List_mouseDown(object sender, MouseEventArgs e) { ListBox listBox = (ListBox)sender; if (listBox.Items.Count == 0) { return; } int index = listBox.IndexFromPoint(e.X, e.Y); if (index < 0) { return; } // todo PanelValue change color /* * int R = 209, G = 17, B = 65; * int d = 10; * int interval_R = R / d, * interval_G = G / d, * interval_B = B / d; * */ string markName = listBox.Items[index].ToString(); GridColumnWithMark selectedColumn = (GridColumnWithMark)_data.Columns[markName]; DragDropEffects dde1 = DoDragDrop(selectedColumn.GetName(false), DragDropEffects.All); EnableValuePanel(selectedColumn); if (dde1 == DragDropEffects.All) { listBox.Items.RemoveAt(listBox.IndexFromPoint(e.X, e.Y)); } }