Exemple #1
0
 public override void MouseDown(Rectangle rect, MouseButtons button, int x, int y)
 {
     if(button == MouseButtons.Right)
     {
         foreach(var reference in _drawnReferences)
         {
             if(reference.Rectangle.X <= x && reference.Rectangle.Right > x)
             {
                 var branch = reference.Reference as BranchBase;
                 if(branch != null)
                 {
                     var menu = new BranchMenu(branch);
                     Utility.MarkDropDownForAutoDispose(menu);
                     Owner.OnContextMenuRequested(menu, new Point(x + 1, y + 1));
                     return;
                 }
                 var tag = reference.Reference as Tag;
                 if(tag != null)
                 {
                     var menu = new TagMenu(tag);
                     Utility.MarkDropDownForAutoDispose(menu);
                     Owner.OnContextMenuRequested(menu, new Point(x + 1, y + 1));
                     return;
                 }
                 var head = reference.Reference as Head;
                 if(head != null)
                 {
                     var menu = new HeadMenu(head);
                     Utility.MarkDropDownForAutoDispose(menu);
                     Owner.OnContextMenuRequested(menu, new Point(x + 1, y + 1));
                     return;
                 }
                 return;
             }
         }
     }
 }