Beispiel #1
0
 private void ShowMenu()
 {
     if (!Host.Visible)
     {
         var args = new CancelEventArgs();
         OnOpening(args);
         if (!args.Cancel)
         {
             //calc screen point for popup menu
             Point point = TargetControlWrapper.TargetControl.Location;
             point.Offset(2, TargetControlWrapper.TargetControl.Height + 2);
             point = TargetControlWrapper.GetPositionFromCharIndex(Fragment.Start);
             point.Offset(2, TargetControlWrapper.TargetControl.Font.Height + 2);
             //
             Host.Show(TargetControlWrapper.TargetControl, point);
             if (CaptureFocus)
             {
                 (Host.ListView  as Control).Focus();
                 //ProcessKey((char) Keys.Down, Keys.None);
             }
         }
     }
     else
     {
         (Host.ListView as Control).Invalidate();
     }
 }
Beispiel #2
0
        private void ShowMenu()
        {
            if (!Host.Visible)
            {
                var args = new CancelEventArgs();
                OnOpening(args);
                if (!args.Cancel)
                {
                    //calc screen point for popup menu
                    Point point = TargetControlWrapper.GetPositionFromCharIndex(Fragment.Start);

                    point = TargetControlWrapper.TargetControl.PointToScreen(point);
                    ToolStripDropDownDirection tsddd = ToolStripDropDownDirection.Default;

                    if (point.Y + Host.Size.Height > Screen.PrimaryScreen.Bounds.Height - 60)
                    {
                        tsddd = ToolStripDropDownDirection.AboveRight;
                        point = TargetControlWrapper.GetPositionFromCharIndex(Fragment.Start);
                        point.Offset(2, 10);
                    }
                    else
                    {
                        point = TargetControlWrapper.GetPositionFromCharIndex(Fragment.Start);
                        point.Offset(2, TargetControlWrapper.TargetControl.Font.Height + 10);
                    }
                    Host.evtHostSizeChanged += new dlgHandleHostSizeChanged(Host_evtHostSizeChanged);
                    Host.Show(TargetControlWrapper.TargetControl, point, tsddd);

                    if (CaptureFocus)
                    {
                        (Host.ListView  as Control).Focus();
                    }
                }
            }
            else
            {
                (Host.ListView as Control).Invalidate();
            }
        }