Esempio n. 1
0
        private void listView1_MouseMove(object sender, MouseEventArgs e)
        {
            // Change the cursor to the "hand" when the mouse is over a cell for a TestConnectionResult.

            ServerListItem mouseItem = listView1.GetItemAt(e.X, e.Y) as ServerListItem;

            if (mouseItem == null || mouseItem.TestConnectionResult == null)
            {
                Cursor = Cursors.Default;
            }
            else
            {
                // We're on a row that has a TestConnectionResult.  See if we're
                // on the cell for the TestConnectionResult.
                var subitem = mouseItem.GetSubItemAt(e.X, e.Y);

                if (subitem == mouseItem.SubItems[colTestResult.Index])
                {
                    Cursor = Cursors.Hand;
                }
                else
                {
                    Cursor = Cursors.Default;
                }
            }
        }
Esempio n. 2
0
        private void listView1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Clicks == 1)
            {
                ServerListItem clickedItem = listView1.GetItemAt(e.X, e.Y) as ServerListItem;

                if (clickedItem != null && clickedItem.Index >= 0)
                {
                    if (e.Button == MouseButtons.Left)
                    {
                        // Check for the TestResult column and check if it's a "link".
                        if (clickedItem.TestConnectionResult != null)
                        {
                            // We're on a row that has a TestConnectionResult.  See if we're
                            // on the cell for the TestConnectionResult.

                            var subitem = clickedItem.GetSubItemAt(e.X, e.Y);

                            if (subitem == clickedItem.SubItems[colTestResult.Index])
                            {
                                clickedItem.TestConnectionResult.Show();
                            }
                        }
                    }
                    else if (e.Button == MouseButtons.Right && clickedItem.Selected && _waitingTests == 0)
                    {
                        editServerMenuItem.Enabled = listView1.SelectedItems.Count == 1;
                        contextMenuStrip1.Show(listView1, e.Location);
                    }
                }
            }
        }