Advertisement
Timtsa

Untitled

Jun 5th, 2019
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication8
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         int count = 2;
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void toolStripMenuItem3_MouseEnter(object sender, EventArgs e)
  22.         {
  23.             ToolStripMenuItem child = new ToolStripMenuItem(""+count);
  24.             ToolStripMenuItem current = sender as ToolStripMenuItem;
  25.             if (current.DropDownItems.Count == 0)
  26.             {
  27.                 current.DropDownItems.Add(child);
  28.                 current.Name = "curent " + count;
  29.                 count++;
  30.             }
  31.             child.MouseEnter += toolStripMenuItem3_MouseEnter;
  32.             current.Click += Child_Click;
  33.             current.Click += Current_Click;
  34.             child.MouseDown += Current_MouseDown;
  35.         }
  36.  
  37.         private void Current_MouseDown(object sender, MouseEventArgs e)
  38.         {
  39.             if (e.Button==MouseButtons.Right)
  40.             {
  41.  
  42.                 this.toolStripMenuItem3.MergeAction;
  43.                 if (sender!=null)
  44.                 {
  45.  
  46.                 }
  47.                 ToolStripMenuItem curent = sender as ToolStripMenuItem;
  48.                 curent.
  49.                 curent.Dispose();
  50.                
  51.             }
  52.  
  53.         }
  54.  
  55.         private void Current_Click(object sender, EventArgs e)
  56.         {
  57.            
  58.         }
  59.  
  60.         private void Child_Click(object sender, EventArgs e)
  61.         {
  62.             ToolStripMenuItem current = sender as ToolStripMenuItem;
  63.             MessageBox.Show(current.Name);
  64.         }
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         //private void toolStripMenuItem3_Click(object sender, EventArgs e)
  71.         //{
  72.  
  73.         //    {
  74.         //        MessageBox.Show(toolStripMenuItem1.Name);
  75.         //    }
  76.         //}
  77.  
  78.         private void Form1_MouseClick(object sender, MouseEventArgs e)
  79.         {
  80.             MessageBox.Show(toolStripMenuItem1.Name);
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement