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


C# Region.IsEmpty方法代码示例

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


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

示例1: ctor_GraphicsPath

		public void ctor_GraphicsPath () {
			GraphicsPath path = new GraphicsPath ();
			path.AddRectangle (rect);
			Region r1 = new Region (path);
			r1.Xor (r);
			Assert.IsTrue (r1.IsEmpty (t.Graphics));
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:Region.cs

示例2: CheckEmpty

		// a region with an "empty ctor" graphic path is "empty" (i.e. not infinite)
		private void CheckEmpty (string prefix, Region region)
		{
			Assert.IsTrue (region.IsEmpty (graphic), prefix + "IsEmpty");
			Assert.IsFalse (region.IsInfinite (graphic), prefix + "graphic");

			RectangleF rect = region.GetBounds (graphic);
			Assert.AreEqual (0f, rect.X, prefix + "GetBounds.X");
			Assert.AreEqual (0f, rect.Y, prefix + "GetBounds.Y");
			Assert.AreEqual (0f, rect.Width, prefix + "GetBounds.Width");
			Assert.AreEqual (0f, rect.Height, prefix + "GetBounds.Height");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:RegionNonRectTest.cs

示例3: EmptyRegionWithInfiniteRegion

		public void EmptyRegionWithInfiniteRegion ()
		{
			Region empty = new Region ();
			empty.MakeEmpty ();
			Assert.IsTrue (empty.IsEmpty (graphic), "IsEmpty");

			Region region = new Region ();
			Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");

			region.Union (empty);
			Assert.IsTrue (region.IsInfinite (graphic), "Union-IsInfinite");

			region.Xor (empty);
			Assert.IsTrue (region.IsInfinite (graphic), "Xor-IsInfinite");

			region.Exclude (empty);
			Assert.IsTrue (region.IsInfinite (graphic), "Exclude-IsInfinite");

			region.Intersect (empty);
			Assert.IsTrue (region.IsEmpty (graphic), "Intersect-IsEmpty");

			region.MakeInfinite ();
			region.Complement (empty);
			Assert.IsTrue (region.IsEmpty (graphic), "Complement-IsEmpty");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:25,代码来源:RegionNonRectTest.cs

示例4: EmptyPathWithInfiniteRegion

		public void EmptyPathWithInfiniteRegion ()
		{
			GraphicsPath gp = new GraphicsPath ();
			Region region = new Region ();
			Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");

			region.Union (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "Union-IsInfinite");

			region.Xor (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "Xor-IsInfinite");

			region.Exclude (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "Exclude-IsInfinite");

			region.Intersect (gp);
			Assert.IsTrue (region.IsEmpty (graphic), "Intersect-IsEmpty");

			region.MakeInfinite ();
			region.Complement (gp);
			Assert.IsTrue (region.IsEmpty (graphic), "Complement-IsEmpty");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:22,代码来源:RegionNonRectTest.cs

示例5: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            DateTime startDate = DateTime.Today;
            DateTime endDate = DateTime.Today.AddDays(1);

            Region clippingRegion = e.Graphics.Clip;

            foreach (GuideProgramCell cell in _guideProgramCells)
            {
                Rectangle visibleRectangle = new Rectangle(cell.Rectangle.Location, cell.Rectangle.Size);
                visibleRectangle.Intersect(e.ClipRectangle);

                Region cellRegion = new Region(visibleRectangle);
                cellRegion.Intersect(clippingRegion);
                if (cellRegion.IsEmpty(e.Graphics))
                {
                    continue;
                }

                bool clipLeft = (visibleRectangle.Left != cell.Rectangle.Left) || cell.ClipLeft;
                bool clipRight = (visibleRectangle.Right != cell.Rectangle.Right) || cell.ClipRight;
                Padding innerPadding = new Padding(2, 2, 2, 2);

                bool onNow = false;
                if (_cursorAtTime.HasValue)
                {
                    DateTime cursorTime = DateTime.Today.Add(_cursorAtTime.Value);
                    onNow = (cell.StartTime <= cursorTime) && (cell.StopTime > cursorTime);
                }
                bool isRecording = IsRecording(cell);

                e.Graphics.SetClip(visibleRectangle);
                if (cell.GuideProgram == null)
                {
                    e.Graphics.FillRectangle(_unusedAreaBrush, visibleRectangle);
                }
                else if (!cell.IsBroadcasted)
                {
                    e.Graphics.FillRectangle(_channelNotBroadcastedCellBrush, visibleRectangle);
                }
                else if (cell == _highlightedCell)
                {
                    e.Graphics.FillRectangle(isRecording ? _highlightRecordingCellBrush : (onNow ? _highlightOnNowCellBrush : _highlightCellBrush), visibleRectangle);
                }
                else if (isRecording)
                {
                    e.Graphics.FillRectangle(_recordingCellBrush, visibleRectangle);
                }
                else if (onNow)
                {
                    e.Graphics.FillRectangle(_onNowCellBrush, visibleRectangle);
                }
                if (cell.IsTop)
                {
                    e.Graphics.DrawLine(_epgBorderPen, visibleRectangle.Left, cell.Rectangle.Top, visibleRectangle.Right - 1, cell.Rectangle.Top);
                    innerPadding.Top++;
                }
                if (clipLeft)
                {
                    e.Graphics.DrawLine(_epgDashedBorderPen, visibleRectangle.Left, cell.Rectangle.Top, visibleRectangle.Left, cell.Rectangle.Bottom - 1);
                    innerPadding.Left++;
                }
                else if (cell.Rectangle.Left == 0)
                {
                    e.Graphics.DrawLine(_epgBorderPen, visibleRectangle.Left, cell.Rectangle.Top, visibleRectangle.Left, cell.Rectangle.Bottom - 1);
                    innerPadding.Left++;
                }
                Pen rightBorderPen = _epgBorderPen;
                if (clipRight)
                {
                    rightBorderPen = _epgDashedBorderPen;
                }
                e.Graphics.DrawLine(_epgBorderPen, visibleRectangle.Right - 1, cell.Rectangle.Bottom - 1, visibleRectangle.Left, cell.Rectangle.Bottom - 1);
                e.Graphics.DrawLine(rightBorderPen, visibleRectangle.Right - 1, cell.Rectangle.Top, visibleRectangle.Right - 1, cell.Rectangle.Bottom - 1);

                int innerWidth = visibleRectangle.Width - innerPadding.Horizontal;
                int innerHeight = cell.Rectangle.Height - innerPadding.Vertical;
                if (cell.GuideProgram != null
                    && innerWidth > 0
                    && innerHeight > 0)
                {
                    Rectangle innerRectangle = new Rectangle(visibleRectangle.Left + innerPadding.Left, cell.Rectangle.Top + innerPadding.Top, innerWidth, innerHeight);
                    e.Graphics.SetClip(innerRectangle);

                    TimeSpan time = cell.GuideProgram.StartTime.TimeOfDay;
                    TimeSpan endTime = cell.GuideProgram.StopTime.TimeOfDay;
                    string timeText = EpgTimeControl.GetTimeString(time);
                    string endTimeText = EpgTimeControl.GetTimeString(endTime);
                    string timeLabelText = timeText;
                    if (clipLeft)
                    {
                        timeLabelText = "<" + timeText;
                    }
                    if (clipRight)
                    {
                        timeLabelText = timeText + "-" + endTimeText;
                    }

                    e.Graphics.DrawString(timeLabelText, _timeFont, _timeBrush, innerRectangle.Left, innerRectangle.Top);

//.........这里部分代码省略.........
开发者ID:dot-i,项目名称:ARGUS-TV-Clients,代码行数:101,代码来源:EpgProgramsGridControl.cs

示例6: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            Region clippingRegion = e.Graphics.Clip;

            using (SchedulerServiceAgent tvSchedulerAgent = new SchedulerServiceAgent())
            {
                foreach (var cell in _channelCells)
                {
                    Rectangle visibleRectangle = new Rectangle(cell.Rectangle.Location, cell.Rectangle.Size);
                    visibleRectangle.Intersect(e.ClipRectangle);

                    Region cellRegion = new Region(visibleRectangle);
                    cellRegion.Intersect(clippingRegion);
                    if (cellRegion.IsEmpty(e.Graphics))
                    {
                        continue;
                    }

                    e.Graphics.SetClip(visibleRectangle);

                    Padding innerPadding = new Padding(2, 2, 2, 2);

                    if (cell.Channel != null)
                    {
                        Rectangle innerRectangle = new Rectangle(cell.Rectangle.Left + innerPadding.Left, cell.Rectangle.Top + innerPadding.Top,
                            cell.Rectangle.Width - innerPadding.Horizontal, cell.Rectangle.Height - innerPadding.Vertical);

                        Image logoImage = null;
                        try
                        {
                            logoImage = ChannelLogosCache.GetLogoImage(tvSchedulerAgent, cell.Channel, (int)(64 * _widthFactor), (int)(64 * _heightFactor));
                        }
                        catch
                        {
                            logoImage = null;
                        }

                        if (logoImage == null)
                        {
                            e.Graphics.DrawString(cell.Channel.DisplayName, _channelFont, _channelBrush,
                                new RectangleF(innerRectangle.Left, innerRectangle.Top + 6, innerRectangle.Width, innerRectangle.Height));
                        }
                        else
                        {
                            e.Graphics.DrawImage(logoImage, innerRectangle.Left + (int)Math.Round((innerRectangle.Width - logoImage.Width) / 2F),
                                innerRectangle.Top + (int)Math.Round((innerRectangle.Height - logoImage.Height) / 2F),
                                logoImage.Width, logoImage.Height);
                        }
                    }
                }
            }
            base.OnPaint(e);
        }
开发者ID:dot-i,项目名称:ARGUS-TV-Clients,代码行数:53,代码来源:EpgChannelsGridControl.cs

示例7: Draw

		public virtual void Draw (Graphics dc, Rectangle clip_rectangle, LinkLabel label)
		{
			Rectangle client_rect = label.PaddingClientRectangle;

			label.DrawImage (dc, label.Image, client_rect, label.ImageAlign);

			if (label.pieces == null)
				return;

			// Paint all text as disabled.
			if (!label.Enabled) {
				dc.SetClip (clip_rectangle);
				ThemeEngine.Current.CPDrawStringDisabled (
					dc, label.Text, label.Font, label.BackColor, client_rect, label.string_format);
				return;
			}

			Font font, link_font = ThemeEngine.Current.GetLinkFont (label);
			
			Region text_region = new Region (new Rectangle());

			// Draw links.
			for (int i = 0; i < label.pieces.Length; i ++) {
				LinkLabel.Piece piece = label.pieces[i];
				
				if (piece.link == null) {
					text_region.Union (piece.region);
					continue;
				}

				Color color = GetPieceColor (label, piece, i);

				if ( (label.LinkBehavior == LinkBehavior.AlwaysUnderline) || 
					 (label.LinkBehavior == LinkBehavior.SystemDefault) ||
					 ((label.LinkBehavior == LinkBehavior.HoverUnderline) && piece.link.Hovered) )
					font = link_font;
				else
					font = label.Font;
				
				dc.Clip = piece.region;
				dc.Clip.Intersect (clip_rectangle);
				dc.DrawString (label.Text, font, 
						ThemeEngine.Current.ResPool.GetSolidBrush (color), 
						client_rect, label.string_format);
			
				// Draw focus rectangle
				if ((piece.link != null) && piece.link.Focused) {
					foreach (RectangleF rect in piece.region.GetRegionScans (dc.Transform))
						ControlPaint.DrawFocusRectangle (dc, Rectangle.Round (rect), label.ForeColor, label.BackColor);
				}
			}
			
			// Draw normal text (without links).
			if (!text_region.IsEmpty (dc)) {
				dc.Clip = text_region;
				dc.Clip.Intersect (clip_rectangle);
				if (!dc.Clip.IsEmpty (dc))
					dc.DrawString(label.Text, label.Font, 
						ThemeEngine.Current.ResPool.GetSolidBrush(label.ForeColor),
						client_rect, label.string_format);
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:62,代码来源:LinkLabelPainter.cs

示例8: UpatePath

        internal void UpatePath(Graphics g)
        {
            if ((base.pretime != base.OwnerDocument.ControlTime) || (base.graphPath == null)||(base.IsChanged))
            {
                PointF[] tfArray3;
                if (base.graphPath == null)
                {
                    base.graphPath = new GraphicsPath();
                }
                base.graphPath.Reset();
                PointF tf1 = new PointF(this.X1, this.Y1);
                PointF tf2 = new PointF(this.X2, this.Y2);
                using (Matrix matrix1 = new Matrix())
                {
                    using (Matrix matrix2 = new Matrix())
                    {
                        bool flag1 = false;
                        bool flag2 = false;
                        if (this.StartGraph != null)
                        {
                            flag1 = true;
                            matrix1.Multiply(this.startGraph.Transform.Matrix);
                            RectangleF ef1 = this.GetBounds(this.startGraph, matrix1);
                            PointF tf3 = new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f));
                            PointF[] tfArray1 = (this.startGraph as IGraph).ConnectPoints.Clone() as PointF[];
                            if ((this.startGraphPointIndex >= 0) && (this.startGraphPointIndex < tfArray1.Length))
                            {
                                flag1 = false;
                                using (Matrix matrix3 = this.startGraph.Transform.Matrix.Clone())
                                {
                                    matrix3.TransformPoints(tfArray1);
                                    tf3 = tfArray1[this.startGraphPointIndex];
                                }
                                using (Matrix matrix5 = this.Transform.Matrix.Clone())
                                {
                                    matrix5.Invert();
                                    PointF[] tfArray5=new PointF[]{tf3};
                                    matrix5.TransformPoints(tfArray5);
                                    tf3=tfArray5[0];
                                }
                            }
                            tf1 = tf3;
                        }
                        if (this.EndGraph != null)
                        {
                            flag2 = true;
                            matrix2.Multiply(this.endGraph.Transform.Matrix);
                            RectangleF ef2 = this.GetBounds(this.endGraph, matrix2);
                            PointF tf4 = new PointF(ef2.X + (ef2.Width / 2f), ef2.Y + (ef2.Height / 2f));
                            PointF[] tfArray2 =(this.endGraph as IGraph).ConnectPoints.Clone() as PointF[];
                            if ((this.endGraphPointIndex >= 0) && (this.endGraphPointIndex < tfArray2.Length))
                            {
                                flag2 = false;
                                using (Matrix matrix4 = this.endGraph.Transform.Matrix.Clone())
                                {
                                    matrix4.TransformPoints(tfArray2);
                                    tf4 = tfArray2[this.endGraphPointIndex];
                                }
                                using (Matrix matrix5 = this.Transform.Matrix.Clone())
                                {
                                    matrix5.Invert();
                                    PointF[] tfArray5=new PointF[]{tf4};
                                    matrix5.TransformPoints(tfArray5);
                                    tf4=tfArray5[0];
                                }
                            }

                            tf2 = tf4;

                        }
                        if ((flag1 || flag2) && (this.startGraph != this.endGraph))
                        {
                            PointF tf5 = tf1;
                            PointF tf6 = tf2;
                            using (GraphicsPath path1 = new GraphicsPath())
                            {
                                path1.AddLine(tf1, tf2);
                                path1.Widen(new Pen(Color.White, 0.1f));
                                if (flag1)
                                {
                                    using (Region region1 = new Region(this.startGraph.GPath))
                                    {
                                        region1.Transform(matrix1);
                                        region1.Intersect(path1);
                                        if (!region1.IsEmpty(g))
                                        {
                                            tf5 = this.Intersect(region1.GetBounds(g), tf5);
                                            using (Matrix matrix5 = this.Transform.Matrix.Clone())
                                            {
                                                matrix5.Invert();
                                                PointF[] tfArray5=new PointF[]{tf5};
                                                matrix5.TransformPoints(tfArray5);
                                                tf5=tfArray5[0];
                                            }
                                        }
                                    }
                                }
                                if (flag2)
                                {
                                    using (Region region2 = new Region(this.endGraph.GPath))
//.........这里部分代码省略.........
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:101,代码来源:ConnectLine.cs

示例9: GetHrgn_Empty_MakeInfinite

		public void GetHrgn_Empty_MakeInfinite ()
		{
			Region r = new Region (new GraphicsPath ());
			Assert.IsTrue (r.IsEmpty (graphic), "Empty");
			Assert.IsFalse (r.IsInfinite (graphic), "!Infinite");
			IntPtr h = r.GetHrgn (graphic);
			Assert.IsFalse (h == IntPtr.Zero, "Handle!=0");

			r.MakeInfinite ();
			Assert.IsFalse (r.IsEmpty (graphic), "!Empty");
			Assert.IsTrue (r.IsInfinite (graphic), "Infinite");
			Assert.AreEqual (IntPtr.Zero, r.GetHrgn (graphic), "Handle==0");
			r.ReleaseHrgn (h);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:14,代码来源:TestRegion.cs

示例10: Complement_383878

		public void Complement_383878 ()
		{
			using (Region clipRegion = new Region ()) {
				clipRegion.MakeInfinite ();

				Rectangle smaller = new Rectangle (5, 5, -10, -10);
				Rectangle bigger = new Rectangle (-5, -5, 12, 12);

				clipRegion.Intersect (smaller);
				clipRegion.Complement (bigger);

				Assert.IsFalse (clipRegion.IsEmpty (graphic), "IsEmpty");
				Assert.IsFalse (clipRegion.IsInfinite (graphic), "IsInfinite");

				RectangleF [] rects = clipRegion.GetRegionScans (new Matrix ());
				Assert.AreEqual (2, rects.Length, "Length");
				Assert.AreEqual (new RectangleF (5, -5, 2, 10), rects [0], "0");
				Assert.AreEqual (new RectangleF (-5, 5, 12, 2), rects [1], "1");
			}
		}
开发者ID:Profit0004,项目名称:mono,代码行数:20,代码来源:TestRegion.cs

示例11: TestInfiniteAndEmpty

		public void TestInfiniteAndEmpty()
		{
			Bitmap bmp = new Bitmap (600, 800);
			Graphics dc = Graphics.FromImage (bmp);
			Rectangle rect1, rect2;
			Region rgn1;
			RectangleF [] rects;
			Matrix matrix = new Matrix ();

			rect1 = new Rectangle (500, 30, 60, 80);
			rect2 = new Rectangle (520, 40, 60, 80);
			rgn1 = new Region (rect1);
			rgn1.Union (rect2);

			Assert.AreEqual (false, rgn1.IsEmpty (dc));
			Assert.AreEqual (false, rgn1.IsInfinite (dc));

			rgn1.MakeEmpty();
			Assert.AreEqual (true, rgn1.IsEmpty (dc));

			rgn1 = new Region (rect1);
			rgn1.Union (rect2);
			rgn1.MakeInfinite ();
			rects = rgn1.GetRegionScans (matrix);

			Assert.AreEqual (1, rects.Length);
			Assert.AreEqual (-4194304, rects[0].X);
			Assert.AreEqual (-4194304, rects[0].Y);
			Assert.AreEqual (8388608, rects[0].Width);
			Assert.AreEqual (8388608, rects[0].Height);
			Assert.AreEqual (true, rgn1.IsInfinite (dc));
		}
开发者ID:Profit0004,项目名称:mono,代码行数:32,代码来源:TestRegion.cs

示例12: GetHrgn_Infinite_MakeEmpty

		public void GetHrgn_Infinite_MakeEmpty ()
		{
			Region r = new Region ();
			Assert.IsFalse (r.IsEmpty (graphic), "!Empty");
			Assert.IsTrue (r.IsInfinite (graphic), "Infinite");
			Assert.AreEqual (IntPtr.Zero, r.GetHrgn (graphic), "Handle==0");

			r.MakeEmpty ();
			Assert.IsTrue (r.IsEmpty (graphic), "Empty");
			Assert.IsFalse (r.IsInfinite (graphic), "!Infinite");
			IntPtr h = r.GetHrgn (graphic);
			Assert.IsFalse (h == IntPtr.Zero, "Handle!=0");
#if NET_2_0
			r.ReleaseHrgn (h);
#endif
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:TestRegion.cs

示例13: isContains

        /// <summary>
        /// 判断点是否在graphicspath中,这个已经包含了直线判断和文字判断
        /// </summary>
        /// <param name="arrPointF"></param>
        /// <param name="MousePoint"></param>
        /// <returns></returns>
        public virtual bool isContains(PointF MousePoint)
        {
            //我想用graphicspath来判断这个是否在其中,这样子会精简很多
            //只有一句话了,很精简
            //return getGraphicsPath().IsVisible(MousePoint);

            //首选用路径判断
            GraphicsPath gpath = getGraphicsPath();//取得路径

            if (gpath.IsVisible(MousePoint))
            {
                return true;//返回真就可以了
            }

            //如下还的判断线段
            //GraphicsPath.PathTypes 属性,这个返回的是一个数组
            //值  含义
            // 0  指示此点是图形的起始点。
            // 1  指示此点是线段的两个终结点之一。
            // 3   指示此点是立方贝塞尔样条的终结点或控制点。
            //0x7 对三个低序位(指示点类型)之外的所有位进行掩码。
            //0x20 指定此点是一个标记。
            //0x80 指定此点是闭合子路径(图形)中的最后一点。
            //一个选段总是前面一个0,后边一个1,因为第一个点是图形的起始点

            //取得所有点
            PointF[] pathPointfs = gpath.PathPoints;
            byte[] pathPointType1 = gpath.PathTypes;//获得点的类型

            //线段总是先一个0,再一个1
            for (int i = 0; i < pathPointType1.Length; i++)
            {
                float fltDistance;

                //直线的判定如果这个为1,就判断前一个是否为0
                if ((pathPointType1[i] == 1)//如果这个等于1
                    && (i - 1 >= 0) &&            //并且上一个没有超出边界,实际上这个不太需要
                    (pathPointType1[i - 1] == 0))//并且上一个等于0
                {
                    fltDistance = getPointLineDistance(pathPointfs[i], pathPointfs[i - 1], MousePoint);

                    //如果这个距离小于精度
                    if (fltDistance <= fltJingDu)
                        return true;

                }

                //为了应对string类型的,我决定每个点都判断距离
                fltDistance = getPointDistance(pathPointfs[i], MousePoint);
                //如果这个距离小于精度
                if (fltDistance <= fltJingDu)
                    return true;

            }

            //到这里肯定返回假了
            return false;

            //如下的也没有用,只是为了增加别人破解的难度
            Region region = new Region(getGraphicsPath());
            region.Intersect(new RectangleF(MousePoint, new SizeF(10, 10)));

            Bitmap bitmap = new Bitmap(1000, 1000);
            Graphics g = Graphics.FromImage(bitmap);
            g.PageUnit = GraphicsUnit.Millimeter;

            return !region.IsEmpty(g);

            //如下的没有作用,只是为了增加别人破解。
            int intResult = PtInPolygon(MousePoint, getRealPoint());

            if (intResult == -1)
                return false;

            return true;

            /**
            System.Drawing.Drawing2D.GraphicsPath   myGraphicsPath=new System.Drawing.Drawing2D.GraphicsPath();
            Region myRegion=new Region();
            myGraphicsPath.Reset();

            myGraphicsPath.AddPolygon(getRealPoint() );
            myRegion.MakeEmpty();
            myRegion.Union(myGraphicsPath);
            //返回判断点是否在多边形里
            return  myRegion.IsVisible(MousePoint);
             * */
        }
开发者ID:kerwinxu,项目名称:barcodeManager,代码行数:94,代码来源:ShapeEle.cs

示例14: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            Region clippingRegion = e.Graphics.Clip;

            TimeSpan time = TimeSpan.FromHours(EpgControl.EpgHoursOffset);
            int left = 0;
            const int step = 15;
            for (int count = 0; count < (24 * 60) / step; count++)
            {
                TimeSpan nextTime = time.Add(TimeSpan.FromMinutes(step));
                int nextLeft = EpgTimeControl.GetTimeCursorPosition(nextTime, 0);
                Rectangle visibleRectangle = new Rectangle(left - 1, 0, nextLeft - left + 1, this.Height);
                visibleRectangle.Intersect(e.ClipRectangle);

                Region cellRegion = new Region(visibleRectangle);
                cellRegion.Intersect(clippingRegion);
                if (!cellRegion.IsEmpty(e.Graphics))
                {
                    int lineLeft = Math.Max(0, left - 1);
                    e.Graphics.DrawLine(_epgBorderPen, lineLeft, 0, lineLeft, this.Height - 1);
                    string timeText = EpgTimeControl.GetTimeString(time);
                    e.Graphics.DrawString(timeText, _timeFont, _timeBrush, lineLeft + 1, 2);
                }

                left = nextLeft;
                time = nextTime;
            }

            if (this.CursorAtTime.HasValue)
            {
                int position = EpgTimeControl.GetTimeCursorPosition(_cursorAtTime.Value, -1);
                e.Graphics.DrawLine(_cursorPen, position, 0, position, this.Height - 1);
                e.Graphics.DrawLine(_cursorShadowPen, position + 1, 0, position + 1, this.Height - 1);

                string timeText = EpgTimeControl.GetTimeString(this.CursorAtTime.Value);
                SizeF size = e.Graphics.MeasureString(timeText, _cursorFont);

                e.Graphics.FillRectangle(_cursorBgBrush, position + 2, 1, size.Width, size.Height);
                e.Graphics.DrawString(timeText, _cursorFont, _cursorBrush, position + 2, 0);
            }

            base.OnPaint(e);
        }
开发者ID:dot-i,项目名称:ARGUS-TV-Clients,代码行数:43,代码来源:EpgTimeGridControl.cs

示例15: DetermineRegionToRefresh

 private Region DetermineRegionToRefresh(object primarySelection)
 {
     Rectangle[] curSelectionBounds;
     Rectangle[] prevSelectionBounds;
     Region region = new Region(Rectangle.Empty);
     if (this.curSelectionBounds.Length >= this.prevSelectionBounds.Length)
     {
         curSelectionBounds = this.curSelectionBounds;
         prevSelectionBounds = this.prevSelectionBounds;
     }
     else
     {
         curSelectionBounds = this.prevSelectionBounds;
         prevSelectionBounds = this.curSelectionBounds;
     }
     bool[] flagArray = new bool[prevSelectionBounds.Length];
     for (int i = 0; i < prevSelectionBounds.Length; i++)
     {
         flagArray[i] = false;
     }
     for (int j = 0; j < curSelectionBounds.Length; j++)
     {
         bool flag = false;
         Rectangle rect = curSelectionBounds[j];
         for (int m = 0; m < prevSelectionBounds.Length; m++)
         {
             if (rect.IntersectsWith(prevSelectionBounds[m]))
             {
                 Rectangle rectangle2 = prevSelectionBounds[m];
                 flag = true;
                 if (rect != rectangle2)
                 {
                     region.Union(rect);
                     region.Union(rectangle2);
                 }
                 flagArray[m] = true;
                 break;
             }
         }
         if (!flag)
         {
             region.Union(rect);
         }
     }
     for (int k = 0; k < flagArray.Length; k++)
     {
         if (!flagArray[k])
         {
             region.Union(prevSelectionBounds[k]);
         }
     }
     using (Graphics graphics = this.behaviorService.AdornerWindowGraphics)
     {
         if ((!region.IsEmpty(graphics) || (primarySelection == null)) || primarySelection.Equals(this.prevPrimarySelection))
         {
             return region;
         }
         for (int n = 0; n < this.curSelectionBounds.Length; n++)
         {
             region.Union(this.curSelectionBounds[n]);
         }
     }
     return region;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:64,代码来源:SelectionManager.cs


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