コード例 #1
0
 private void lvRecords_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ListViewHitTestInfo info = lvRecords.HitTest(e.Location);
         if (info.Item != null)
         {
             DnsPodApi.Record tag = (DnsPodApi.Record)info.Item.Tag;
             if (tag.IsMonitor)
             {
                 contextMenuStrip1.Items[1].Visible = true;
                 contextMenuStrip1.Items[2].Visible = true;
                 contextMenuStrip1.Items[0].Text    = "禁用监控";
             }
             else
             {
                 contextMenuStrip1.Items[1].Visible = false;
                 contextMenuStrip1.Items[2].Visible = false;
                 contextMenuStrip1.Items[0].Text    = "启用监控";
             }
             contextMenuStrip1.Show(lvRecords, e.Location);
         }
     }
 }
コード例 #2
0
ファイル: FDdns.cs プロジェクト: funwaywang/DNSPodClientLite
 private void lvRecords_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ListViewHitTestInfo info = lvRecords.HitTest(e.Location);
         if (info.Item != null)
         {
             DnsPodApi.Record tag = (DnsPodApi.Record)info.Item.Tag;
             if (tag.IsDdns)
             {
                 menuEnableDdns.Visible    = false;
                 menuManualRefresh.Visible = true;
                 menuDisableDdns.Visible   = true;
             }
             else
             {
                 menuEnableDdns.Visible    = true;
                 menuManualRefresh.Visible = false;
                 menuDisableDdns.Visible   = false;
             }
             contextMenuStrip1.Show(lvRecords, e.Location);
         }
     }
 }