예제 #1
0
        private string OutsideMenuContext(ContextMenuStrip posContexts)
        {
            if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left)
            {
                //Point c = (this.Location);

                Point d = posContexts.Location;

                //c.X += d.X;
                //c.Y += d.Y;

                Rectangle r = new Rectangle(d, posContexts.Size);

                //location = this.RectangleToScreen(location);

                //Rectangle location = (posContext.ClientRectangle);

                Point p = (Cursor.Position);

                //Point p = Cursor.Position;

                if (r.Contains(p) == false)
                {
                    shouldclose = true;
                    posContexts.Close();

                    completed = true;

                    return("true");
                }
                else
                {
                    posContexts.Select();
                }
            }
            else
            {
                posContexts.Select();
            }

            completed = false;

            return("false");
        }