当前位置: 首页>>代码示例>>C#>>正文


C# Region.Exclude方法代码示例

本文整理汇总了C#中System.Drawing.Region.Exclude方法的典型用法代码示例。如果您正苦于以下问题:C# Region.Exclude方法的具体用法?C# Region.Exclude怎么用?C# Region.Exclude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Region的用法示例。


在下文中一共展示了Region.Exclude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScreenRegionForm

        public ScreenRegionForm(Rectangle regionRectangle, bool activateWindow = true)
        {
            InitializeComponent();

            this.activateWindow = activateWindow;

            borderRectangle = regionRectangle.Offset(1);
            borderRectangle0Based = new Rectangle(0, 0, borderRectangle.Width, borderRectangle.Height);

            Location = borderRectangle.Location;
            int windowWidth = Math.Max(borderRectangle.Width, pInfo.Width);
            Size = new Size(windowWidth, borderRectangle.Height + pInfo.Height + 1);
            pInfo.Location = new Point(0, borderRectangle.Height + 1);

            Region region = new Region(ClientRectangle);
            region.Exclude(borderRectangle0Based.Offset(-1));
            region.Exclude(new Rectangle(0, borderRectangle.Height, windowWidth, 1));
            if (borderRectangle.Width < pInfo.Width)
            {
                region.Exclude(new Rectangle(borderRectangle.Width, 0, pInfo.Width - borderRectangle.Width, borderRectangle.Height));
            }
            else if (borderRectangle.Width > pInfo.Width)
            {
                region.Exclude(new Rectangle(pInfo.Width, borderRectangle.Height + 1, borderRectangle.Width - pInfo.Width, pInfo.Height));
            }
            Region = region;

            Timer = new Stopwatch();
        }
开发者ID:andre-d,项目名称:ShareXYZ,代码行数:29,代码来源:ScreenRegionForm.cs

示例2: IsOverLayed

        /// <summary>
        /// Does a hit test for specified control (is point of control visible to user)
        /// </summary>
        /// <param name="ctrlRect">the rectangle (usually Bounds) of the control</param>
        /// <param name="ctrlHandle">the handle for the control</param>
        /// <returns>boolean value indicating if ctrlRect is overlayed by another control </returns>
        public static bool IsOverLayed( Rectangle ctrlRect, IntPtr ctrlHandle )
        {
            // clear results
            enumedwindowPtrs.Clear();
            enumedwindowRects.Clear();

            // Create callback and start enumeration
            callBackPtr = new CallBackPtr( EnumCallBack );
            EnumDesktopWindows( IntPtr.Zero, callBackPtr, 0 );

            // Go from last to first window, and substract them from the ctrlRect area
            Region r = new Region( ctrlRect );

            bool StartClipping = false;
            for( int i = enumedwindowRects.Count - 1; i >= 0; i-- )
            {
                if( StartClipping )
                {
                    r.Exclude( enumedwindowRects[i] );
                }

                if( enumedwindowPtrs[i] == ctrlHandle ) StartClipping = true;
            }

            //Creating a list of points scattered on the edges of the window.
            IList<System.Drawing.Point> pointList = new List<System.Drawing.Point>();
            pointList.Add( new System.Drawing.Point( ctrlRect.X, ctrlRect.Y ) );
            pointList.Add( new System.Drawing.Point( ctrlRect.X + ctrlRect.Width - 2, ctrlRect.Y ) );
            pointList.Add( new System.Drawing.Point( ctrlRect.X + ctrlRect.Width - 2, ctrlRect.Y + ctrlRect.Height - 2 ) );
            pointList.Add( new System.Drawing.Point( ctrlRect.X, ctrlRect.Y + ctrlRect.Height - 2 ) );

            //TODO : choose the scale considering the width and height of the window.
            int scale = 50;
            int xOffset = 0;
            int yOffset = 0;
            int offset = 2;
            for( int x = 0; x <= scale; x++ )
            {
                for( int y = 0; y <= scale; y++ )
                {
                    if( y == scale ) yOffset = offset;
                    else yOffset = 0;

                    if( x == scale ) xOffset = offset;
                    else xOffset = 0;

                    pointList.Add( new System.Drawing.Point( ctrlRect.X + ctrlRect.Width / scale * x - xOffset, ctrlRect.Y + ctrlRect.Height / scale * y - yOffset ) );
                }
            }

            //Checking if theses points are visible by the user
            foreach( var item in pointList )
            {
                if( !r.IsVisible( item ) ) return true;
            }

            return false;
        }
开发者ID:Nementon,项目名称:ck-desktop,代码行数:64,代码来源:WindowHelper.cs

示例3: ScreenRegionForm

        public ScreenRegionForm(Rectangle regionRectangle)
        {
            InitializeComponent();

            borderRectangle = regionRectangle.RectangleOffset(1);
            borderRectangle0Based = new Rectangle(0, 0, borderRectangle.Width, borderRectangle.Height);

            Location = borderRectangle.Location;
            Size = new Size(borderRectangle.Width, borderRectangle.Height + pInfo.Height);
            pInfo.Location = new Point(Width - pInfo.Width, Height - pInfo.Height);

            Region region = new Region(ClientRectangle);
            region.Exclude(borderRectangle0Based.RectangleOffset(-1));
            region.Exclude(new Rectangle(0, pInfo.Location.Y, pInfo.Location.X, pInfo.Height));
            Region = region;

            Timer = new Stopwatch();
        }
开发者ID:Edison6351,项目名称:ShareX,代码行数:18,代码来源:ScreenRegionForm.cs

示例4: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            rect = new Rectangle(Point.Empty, this.Size);
            region = new Region(rect);

            rect.Inflate(-1 * (this.Width - 3), -1 * (this.Height - 3));
            region.Exclude(rect);

            this.Region = region;
            this.Owner = Program.GUIref;
        }
开发者ID:sdrobs,项目名称:vendfriend,代码行数:11,代码来源:popout-grid.cs

示例5: BlockRegions

        static BlockRegions()
        {
            int n = Constants.PROJ_WIDTH / 4;

            WholeBlock = new Region();
            WholeBlock.MakeEmpty();
            for (int i = 0; i <= n; i++)
            {
                WholeBlock.Union(new Rectangle(n * 2 - 1 - 2 * i, i, i * 4 + 2, Constants.PROJ_HEIGHT - 2 * i));
            }
            WholeBlock.Intersect(new Rectangle(0, 0, Constants.PROJ_WIDTH, Constants.PROJ_HEIGHT));
            InnerBlock = new Region();
            InnerBlock.MakeEmpty();
            for (int i = 0; i <= n; i++)
            {
                InnerBlock.Union(new Rectangle(n * 2 - 1 - 2 * i, i + 1, i * 4 + 2, Constants.PROJ_HEIGHT - 2 - 2 * i));
            }
            InnerBlock.Intersect(new Rectangle(1, 1, Constants.PROJ_WIDTH - 2, Constants.PROJ_HEIGHT - 2));

            OuterBorder = WholeBlock.Clone();
            OuterBorder.Exclude(InnerBlock);

            Top = InnerBlock.Clone();
            Top.Translate(0, -Constants.BLOCK_HEIGHT);
            Top.Intersect(InnerBlock);

            Left = InnerBlock.Clone();
            Left.Exclude(Top);
            Top.Translate(0, 1);
            Left.Exclude(Top);
            Top.Translate(0, -1);

            Right = Left.Clone();
            Left.Intersect(new Rectangle(0, 0, Constants.PROJ_WIDTH / 2, Constants.PROJ_HEIGHT));
            Right.Intersect(new Rectangle(Constants.PROJ_WIDTH / 2 + 1, 0, Constants.PROJ_WIDTH / 2, Constants.PROJ_HEIGHT));

            InnerBorder = InnerBlock.Clone();
            InnerBorder.Exclude(Top);
            InnerBorder.Exclude(Left);
            InnerBorder.Exclude(Right);
        }
开发者ID:ZetaTwo,项目名称:Project-Easter-Egg,代码行数:41,代码来源:BlockRegions.cs

示例6: ScreenRegionForm

        public ScreenRegionForm(Rectangle regionRectangle)
        {
            InitializeComponent();

            Location = new Point(regionRectangle.X - 1, regionRectangle.Y - 1);
            Size = new Size(regionRectangle.Width + 2, regionRectangle.Height + 2);

            Rectangle rect = ClientRectangle;
            Region region = new Region(rect);
            rect.Inflate(-1, -1);
            region.Exclude(rect);
            Region = region;
        }
开发者ID:dmitriydel,项目名称:sharexmod,代码行数:13,代码来源:ScreenRegionForm.cs

示例7: ApplyRegion

        public void ApplyRegion()
        {
            var r = new Region(new Rectangle(0, 0, MaskImage.Width, MaskImage.Height));

            for (int y = 0; y < MaskImage.Height; y++) {
                for (int x = 0; x < MaskImage.Width; x++) {
                    if (MaskImage.GetPixel(x, y) == TransparencyKey) {
                        r.Exclude(new Rectangle(x, y, 1, 1));
                    }
                }
            }

            Control.Region = r;
            Control.BackgroundImage = MaskImage;
        }
开发者ID:hksonngan,项目名称:sharptracing,代码行数:15,代码来源:RegionHandler.cs

示例8: ScreenRecordForm

        public ScreenRecordForm(Rectangle regionRectangle, bool activateWindow = true, float duration = 0)
        {
            InitializeComponent();
            niTray.Icon = ShareXResources.Icon;

            this.activateWindow = activateWindow;
            this.duration = duration;

            borderRectangle = regionRectangle.Offset(1);
            borderRectangle0Based = new Rectangle(0, 0, borderRectangle.Width, borderRectangle.Height);

            Location = borderRectangle.Location;
            int windowWidth = Math.Max(borderRectangle.Width, pInfo.Width);
            Size = new Size(windowWidth, borderRectangle.Height + pInfo.Height + 1);
            pInfo.Location = new Point(0, borderRectangle.Height + 1);

            Region region = new Region(ClientRectangle);
            region.Exclude(borderRectangle0Based.Offset(-1));
            region.Exclude(new Rectangle(0, borderRectangle.Height, windowWidth, 1));
            if (borderRectangle.Width < pInfo.Width)
            {
                region.Exclude(new Rectangle(borderRectangle.Width, 0, pInfo.Width - borderRectangle.Width, borderRectangle.Height));
            }
            else if (borderRectangle.Width > pInfo.Width)
            {
                region.Exclude(new Rectangle(pInfo.Width, borderRectangle.Height + 1, borderRectangle.Width - pInfo.Width, pInfo.Height));
            }
            Region = region;

            Timer = new Stopwatch();
            UpdateTimer();

            RecordResetEvent = new ManualResetEvent(false);

            ChangeState(ScreenRecordState.Waiting);
        }
开发者ID:raymondle,项目名称:ShareX,代码行数:36,代码来源:ScreenRecordForm.cs

示例9: PaintNonItemRegion

 private void PaintNonItemRegion()
 {
     using (Graphics g = Graphics.FromHwnd(this.Handle))
     using (Region r = new Region(this.ClientRectangle))
     {
         for (int i = 0; i < this.Items.Count; i++)
         {
             Rectangle itemRect = this.GetItemRectangle(i);
             r.Exclude(itemRect);
         }
         using (var brush = new SolidBrush(this.BackColor))
         {
             g.FillRegion(SystemBrushes.Window, r);
         }
     }
 }
开发者ID:wow4all,项目名称:evemu_server,代码行数:16,代码来源:NoFlickerListBox.cs

示例10: DrawFinalImage

		private void DrawFinalImage()
		{
			using (var g = Graphics.FromImage(FinalComposedImage))
			{
				g.DrawImage(BackgroundImage, new Rectangle(0, 0, m_width, m_height));
				g.DrawImage(ContentImage, new Rectangle(0, 0, m_width, m_height));

				if (SelectedSubTexture != null)
				{
					Region rgn = new Region(new Rectangle(0, 0, m_width, m_height));
					rgn.Exclude(new Rectangle(SelectedSubTexture.Left, SelectedSubTexture.Top,
											  SelectedSubTexture.Width, SelectedSubTexture.Height));
					g.FillRegion(m_maskBrush, rgn);
				}
			}
		}
开发者ID:galaxyyao,项目名称:TouhouGrave,代码行数:16,代码来源:View.Draw.cs

示例11: doDraw

        private void doDraw(Graphics g)
        {
            Region baseR = new Region(new Rectangle(0, 0, this.pbParent.Width, this.pbParent.Height));

            foreach (KeyValuePair<String, drawObject> item in drawObjects) {
                if (item.Key.Substring(0, 5) == "table") {
                    baseR.Exclude(Rectangle.Round(item.Value.loc));
                }
            }

            g.FillRegion(new SolidBrush(this.pbParent.BackColor), baseR);

            foreach (KeyValuePair<String, drawObject> item in drawObjects) {
                item.Value.draw(g);
            }
        }
开发者ID:K-4U,项目名称:ese_project4y5,代码行数:16,代码来源:drawer.cs

示例12: Clipping

        /// <summary>
        /// Initialize a new instance of the Clipping class.
        /// </summary>
        /// <param name="graphics">Graphics context.</param>
        /// <param name="path">Path to clip.</param>
        /// <param name="exclude">Exclude path from clipping.</param>
        public Clipping(Graphics graphics, GraphicsPath path, bool exclude)
        {
            // Cache graphics instance
            _graphics = graphics;

            // Save the existing clipping region
            _previousRegion = _graphics.Clip;

            // Add clipping of path to existing clipping region
            _newRegion = _previousRegion.Clone();

            if (exclude)
                _newRegion.Exclude(path);
            else
                _newRegion.Intersect(path);

            _graphics.Clip = _newRegion;
        }
开发者ID:ComponentFactory,项目名称:Krypton,代码行数:24,代码来源:Clipping.cs

示例13: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     switch (cBAreo.CheckState)
     {
     case CheckState.Checked:
     e.Graphics.Clear(Color.Black);                  //将窗体整个背景绘制成黑色
     break;
     case CheckState.Indeterminate:
     Rectangle rect = this.ClientRectangle;
     rect.Inflate(-20, -20);
     Region region = new Region(rect);
     rect.Inflate(-20, -20);
     region.Exclude(rect);                           //获取非Areo区域部分区域
     e.Graphics.FillRegion(Brushes.Black, region);   //窗体部分非Areo区域全透明
     e.Graphics.FillRegion(Brushes.Black, regionAreo);//将窗体Areo边框绘制成黑色
     break;
     }
 }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:18,代码来源:FormAreoRegion.cs

示例14: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     if (Areo.IsAreoEnabled())                        //检测系统是否开启Areo功能
     {
     switch (cBAreo.CheckState)
     {
     case CheckState.Checked:
         e.Graphics.Clear(Color.Black);          //将窗体整个背景绘制成黑色
         break;
     case CheckState.Indeterminate:
         Region region = new Region(this.ClientRectangle);
         Rectangle rect = this.ClientRectangle;
         rect.Inflate(-50, -50);
         region.Exclude(rect);
         e.Graphics.FillRegion(Brushes.Black, region);//将窗体Areo边框绘制成黑色
         break;
     }
     }
 }
开发者ID:dalinhuang,项目名称:wdeqawes-efrwserd-rgtedrtf,代码行数:19,代码来源:FormAreoBorder.cs

示例15: FormTest

        public FormTest()
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);

            InitializeComponent();
            FileManager.FileManager.Initialize();
            deviceTreeList = FileManager.FileManager.GetDeviceList();
            InitTreeView(deviceTreeList, this.tree);
            InitTreeView(deviceTreeList, this.treeView1);
            InitTreeView(deviceTreeList, this.treeViewAlarm);
            checkBox_analyze.Checked = false;
            checkBox_cruise.Checked = false;
            checkBox_record.Checked = false;
            Rectangle rect = video1.Bounds;
            rect.Inflate(-3,-3);
            Region maskRegion = new Region(video1.Bounds);
            maskRegion.Exclude(rect);
            lMask1.Region = maskRegion;
            label_video2.Region = maskRegion;
        }
开发者ID:dalinhuang,项目名称:iloujiok-ffp-csharp,代码行数:20,代码来源:FormTest.cs


注:本文中的System.Drawing.Region.Exclude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。