コード例 #1
0
ファイル: Main.cs プロジェクト: sibaar/CKAN
        private void ModList_MouseDown(object sender, MouseEventArgs e)
        {
            var rowIndex = ModList.HitTest(e.X, e.Y).RowIndex;

            // Ignore header column to prevent errors.
            if (rowIndex != -1 && e.Button == MouseButtons.Right)
            {
                // Detect the clicked cell and select the row.
                ModList.ClearSelection();
                ModList.Rows[rowIndex].Selected = true;

                // Show the context menu.
                ModListContextMenuStrip.Show(ModList, new Point(e.X, e.Y));

                // Set the menu options.
                var guiMod = (GUIMod)ModList.Rows[rowIndex].Tag;

                downloadContentsToolStripMenuItem.Enabled = !guiMod.IsCached;
                reinstallToolStripMenuItem.Enabled        = guiMod.IsInstalled;
            }
        }