Example #1
0
        private void characterSelector_DragDrop(object sender, DragEventArgs e)
        {
            CheckedListBox listBox = sender as CheckedListBox;

            if (e.Data.GetDataPresent(typeof(Character)))
            {
                if (e.Effect == DragDropEffects.Move)
                {
                    Character c     = e.Data.GetData(typeof(Character)) as Character;
                    int       index = listBox.IndexFromPoint(listBox.PointToClient(new Point(e.X, e.Y)));
                    if (index > -1)
                    {
                        listBox.Items.Insert(index, c);
                        characterCollection.Insert(index, c);

                        int oldSelectedIndex = listBox.SelectedIndex;
                        listBox.Items.RemoveAt(oldSelectedIndex);
                        characterCollection.RemoveAt(oldSelectedIndex);

                        listBox.SelectedItem      = c;
                        characterEditor.Character = c;
                        FireDataChangedEvent();
                    }
                }
                else if (e.Effect == DragDropEffects.Copy)
                {
                    Character c     = e.Data.GetData(typeof(Character)) as Character;
                    int       index = listBox.IndexFromPoint(listBox.PointToClient(new Point(e.X, e.Y)));
                    Character d     = new Character(c.ToByteArray(), index);
                    if (index > -1)
                    {
                        d.Index = (byte)index;
                        listBox.Items.Insert(index, d);
                        listBox.SetItemChecked(index, d.IsPresent);
                        characterCollection.Insert(index, d);

                        listBox.Items.RemoveAt(index + 1);
                        characterCollection.RemoveAt(index + 1);

                        listBox.SelectedItem      = d;
                        characterEditor.Character = d;
                        FireDataChangedEvent();
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Occurs when the mouse is moved over the checkedlistbox.
        /// Sets the tooltip of the item under the pointer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnMouseMoved(object sender, MouseEventArgs e)
        {
            int index = clb.IndexFromPoint(e.X, e.Y);

            if (index >= 0)
            {
                tooltipControl.SetToolTip(clb, ((clbItem)clb.Items[index]).Tooltip);
            }
        }
Example #3
0
 /// <summary>
 /// Функция показывающая информацию о выбранном TestCase
 /// </summary>
 private void ShowToolTip(CheckedListBox checkedListBox, List <ITestCase> testCaseList)
 {
     nToolTipIndex = checkedListBox.IndexFromPoint(checkedListBox.PointToClient(MousePosition));
     if (nToolTipIndex > -1)
     {
         TestCaseInfoForm testCaseInfoForm = new TestCaseInfoForm(testCaseList, nToolTipIndex);
         testCaseInfoForm.ShowDialog();
     }
 }
        private void checkedListBox2_MouseDown(object sender, MouseEventArgs e)
        {
            CheckedListBox check2 = sender as CheckedListBox;

            index = check2.IndexFromPoint(e.X, e.Y);
            if (index >= 0 & e.Button == MouseButtons.Left)
            {
                check2.DoDragDrop(check2.Items[index].ToString(), DragDropEffects.Move);
            }
        }
Example #5
0
        private void CheckedListBox_MouseMove(object sender, MouseEventArgs e)
        {
            CheckedListBox chk = (CheckedListBox)sender;

            Point point = chk.PointToClient(Cursor.Position);
            int   index = chk.IndexFromPoint(point);

            if (index < 0)
            {
                return;
            }

            chk.SelectedItem = chk.Items[index];
        }
Example #6
0
        private void OnListMouseMove(object sender, MouseEventArgs e)
        {
            if (m_LastScreenMouseMove != Cursor.Position)
            {
                int itemHit = m_ListBox.IndexFromPoint(e.Location);

                if (itemHit != -1)
                {
                    m_ListBox.SelectedIndex = itemHit;
                }

                m_LastScreenMouseMove = m_ListBox.PointToScreen(e.Location);
            }
        }
Example #7
0
 public static void ListBox_MouseDownHandler(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         //select the item under the mouse pointer
         CheckedListBox listBox = (CheckedListBox)sender;
         listBox.SelectedIndex = listBox.IndexFromPoint(e.Location);
         if (listBox.SelectedIndex != -1)
         {
             listBox.ContextMenuStrip.Items.Clear();
             //ToolStripMenuItem menuItem = new ToolStripMenuItem("View Folder", null, ViewwFolderEvent);
             ToolStripMenuItem menuItem = new ToolStripMenuItem("View Folder", null, ViewwFolderEvent);
             menuItem.Tag = listBox.SelectedItem;
             listBox.ContextMenuStrip.Items.Add(menuItem);
             listBox.ContextMenuStrip.Show();
         }
     }
 }