111c111,112 < Point pt = control.PointToScreen(pos); --- > Point pt = control.PointToScreen(new Point(0,0)); > Rectangle rcWork = Screen.PrimaryScreen.WorkingArea; 115a117,153 > //align it to control > if (pt.X < Screen.PrimaryScreen.WorkingArea.Left) > { > pt.X += size.Width; > } > if (pt.X > Screen.PrimaryScreen.WorkingArea.Right - size.Width) > { > pt.X -= size.Width; > } > if (pt.Y < Screen.PrimaryScreen.WorkingArea.Top) > { > pt.Y += size.Height; > } > if (pt.Y > Screen.PrimaryScreen.WorkingArea.Bottom - size.Height) > { > pt.Y -= size.Height; > } > //add offset pos > pt.X += pos.X; > pt.Y += pos.Y; > //ensure that it is completely visible on screen > if (pt.X < rcWork.Left) > { > pt.X = rcWork.Left; > } > if (pt.X > rcWork.Right - size.Width) > { > pt.X = rcWork.Right - size.Width; > } > if (pt.Y < rcWork.Top) > { > pt.Y = rcWork.Top; > } > if (pt.Y > rcWork.Bottom + size.Height) > { > pt.Y = rcWork.Bottom - size.Height; > } 186,191c224,229 < < protected internal override void ItemSelectTimerTick(object sender, EventArgs e) < { < base.ItemSelectTimerTick (sender, e); < ItemSelected(currentMouseItem); < } --- > > protected internal override void ItemSelectTimerTick(object sender, EventArgs e) > { > base.ItemSelectTimerTick (sender, e); > ItemSelected(currentMouseItem); > } 237,241c275,279 < // Convert the associated control (the form) mouse position to be relative to this ContextMenu. < Point pt = new Point(e.X, e.Y); < pt = associatedControl.PointToScreen(pt); < pt.X -= popupControl.Left; < pt.Y -= popupControl.Top; --- > // Convert the associated control (the form) mouse position to be relative to this ContextMenu. > Point pt = new Point(e.X, e.Y); > pt = associatedControl.PointToScreen(pt); > pt.X -= popupControl.Left; > pt.Y -= popupControl.Top; 244,248c282,286 < < // The mouse move from our child. < private void nextPopupMenu_MouseMove(Object sender, MouseEventArgs e) < { < OnMouseMove(sender, CreateLocalMouseArgs(e)); --- > > // The mouse move from our child. > private void nextPopupMenu_MouseMove(Object sender, MouseEventArgs e) > { > OnMouseMove(sender, CreateLocalMouseArgs(e)); 252,255c290,293 < private void nextPopupMenu_MouseDown(Object sender, MouseEventArgs e) < { < OnMouseDown(sender, CreateLocalMouseArgs(e)); < } --- > private void nextPopupMenu_MouseDown(Object sender, MouseEventArgs e) > { > OnMouseDown(sender, CreateLocalMouseArgs(e)); > } 345,346c383,384 < } < --- > } >