System.Drawing.Region.MakeEmpty C# (CSharp) Method

MakeEmpty() public method

public MakeEmpty ( ) : void
return void
        public void MakeEmpty()
        {
            regionObject = RectangleF.Empty;

            var path = RectangleToPath (RectangleF.Empty);

            // clear out our containers.
            regionList.Clear ();
            solution.Clear ();

            solution.Add (path);
            regionList.Add (new RegionEntry (RegionType.Empty, RectangleF.Empty, path));

            regionPath = new CGPath ();

            regionBounds = Rectangle.Empty;
        }

Usage Example

示例#1
0
        /// <summary>
        /// Returns whether the given rectangle, in screen coordinates, is visible in any screen's
        /// working area (the monitor's visible area minus task bars and docked windows)</summary>
        /// <param name="rect">Rectangle</param>
        /// <returns>Whether the given rectangle is visible</returns>
        public static bool IsOnScreen(Rectangle rect)
        {
            using (Region region = new Region())
            {
                region.MakeEmpty();
                foreach (Screen screen in Screen.AllScreens)
                    region.Union(screen.WorkingArea);

                rect.Inflate(-Margin, -Margin);
                return region.IsVisible(rect);
            }
        }
All Usage Examples Of System.Drawing.Region::MakeEmpty