Ejemplo n.º 1
0
        private void Setline(ListBox target, bool visible, DragEventArgs e)
        {
            panel1.Visible = visible;
            if (target == null)
            {
                return;
            }

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

            p = (target).PointToClient(p);

            int indexOfItem = EventBox.IndexFromPoint(p.X, p.Y);
            int y           = target.PointToClient(p).Y;

            int x1 = target.Left;
            int x2 = target.Width;
            int ih = target.ItemHeight;

            int y1 = (int)Math.Min(Math.Round((double)(y / ih)), target.Items.Count) * ih + target.Top;

            panel1.Left   = x1;
            panel1.Top    = y1;
            panel1.Width  = x2;
            panel1.Height = 2;
        }
Ejemplo n.º 2
0
        private void EventBox_DragDrop(object sender, DragEventArgs e)
        {
            if (dragsource != sender)
            {
                ChangeStatelSelection();
                return;
            }
            Point p = new Point(e.X, e.Y);

            p = ((ListBox)sender).PointToClient(p);

            int indexOfItem = EventBox.IndexFromPoint(p.X, p.Y);

            if ((indexOfItem >= 0) && (indexOfItem < EventBox.Items.Count))
            {
                StatelEvent se = events.ElementAt(indexOfItem);
                se.changeid(selectedstatel, evdrag.eventid);
                ChangeStatelSelection();
            }
            Setline(null, false, null);
        }