當前位置: 首頁>>代碼示例>>C#>>正文


C# Region.IsInfinite方法代碼示例

本文整理匯總了C#中System.Drawing.Region.IsInfinite方法的典型用法代碼示例。如果您正苦於以下問題:C# Region.IsInfinite方法的具體用法?C# Region.IsInfinite怎麽用?C# Region.IsInfinite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Drawing.Region的用法示例。


在下文中一共展示了Region.IsInfinite方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: Region_Polygon5_IsInfinite

		public void Region_Polygon5_IsInfinite ()
		{
			// overlap the first/last point
			Point[] points = new Point[5] { new Point (-4194304, -4194304), new Point (-4194304, 4194304), new Point (4194304, 4194304), new Point (4194304, -4194304), new Point (-4194304, -4194304) };
			GraphicsPath gp = new GraphicsPath ();
			gp.AddPolygon (points);
			CheckInfiniteBounds (gp);

			Region region = new Region (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "IsInfinite");
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:11,代碼來源:RegionNonRectTest.cs

示例3: Region_Curve_IsInfinite

		public void Region_Curve_IsInfinite ()
		{
			Point[] points = new Point[2] { new Point (-4194304, -4194304), new Point (4194304, 4194304) };
			GraphicsPath gp = new GraphicsPath ();
			gp.AddCurve (points);
			CheckInfiniteBounds (gp);

			Region region = new Region (gp);
			Assert.IsFalse (region.IsInfinite (graphic), "IsInfinite");
			// note: infinity isn't based on the bounds
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:11,代碼來源:RegionNonRectTest.cs

示例4: FromRegion

        /// <devdoc>
        ///     Creates a WindowsRegion from a System.Drawing.Region. 
        /// </devdoc>
        public static WindowsRegion FromRegion( Region region, Graphics g ){
            if (region.IsInfinite(g)){
                // An infinite region would cover the entire device region which is the same as
                // not having a clipping region. Observe that this is not the same as having an
                // empty region, which when clipping to it has the effect of excluding the entire
                // device region.
                // To remove the clip region from a dc the SelectClipRgn() function needs to be
                // called with a null region ptr - that's why we use the empty constructor here.
                // GDI+ will return IntPtr.Zero for Region.GetHrgn(Graphics) when the region is
                // Infinite.
                return new WindowsRegion();
            }

            return WindowsRegion.FromHregion(region.GetHrgn(g), true);
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:18,代碼來源:WindowsRegion.cs

示例5: FromRegion

 public static WindowsRegion FromRegion(Region region, Graphics g)
 {
     if (region.IsInfinite(g))
     {
         return new WindowsRegion();
     }
     return FromHregion(region.GetHrgn(g), true);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:8,代碼來源:WindowsRegion.cs

示例6: 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

示例7: 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

示例8: 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

示例9: InfinityScaleDown

		public void InfinityScaleDown ()
		{
			using (Region r = new Region ()) {
				Assert.IsTrue (r.IsInfinite (graphic), "before");
				using (Matrix m = new Matrix ()) {
					m.Scale (0.5f, 0.5f);
					r.Transform (m);
				}
				Assert.IsTrue (r.IsInfinite (graphic), "after");
				CheckEmpty ("InfinityScaleDown", r);
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:12,代碼來源:TestRegion.cs

示例10: InfinityTranslate

		public void InfinityTranslate ()
		{
			using (Region r = new Region ()) {
				Assert.IsTrue (r.IsInfinite (graphic), "before");
				r.Translate (10, 10);
				Assert.IsTrue (r.IsInfinite (graphic), "after");
				CheckEmpty ("InfinityTranslate", r);
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:9,代碼來源:TestRegion.cs

示例11: InfinityIntersectTransform

		public void InfinityIntersectTransform ()
		{
			using (Region r = new Region ()) {
				Assert.IsTrue (r.IsInfinite (graphic), "before");
				r.Intersect (new Rectangle (-10, -10, 20, 20));
				using (Matrix m = new Matrix (2, 0, 0, 0.5f, 10, 10)) {
					r.Transform (m);
				}
				RectangleF bounds = r.GetBounds (graphic);
				Assert.AreEqual (-10, bounds.X, "X");
				Assert.AreEqual (5, bounds.Y, "Y");
				Assert.AreEqual (40, bounds.Width, "Width");
				Assert.AreEqual (10, bounds.Height, "Height");
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:15,代碼來源:TestRegion.cs

示例12: InfinityIntersectTranslate

		public void InfinityIntersectTranslate ()
		{
			using (Region r = new Region ()) {
				Assert.IsTrue (r.IsInfinite (graphic), "before");
				r.Intersect (new Rectangle (-10, -10, 20, 20));
				r.Translate (10, 10);
				RectangleF bounds = r.GetBounds (graphic);
				Assert.AreEqual (0, bounds.X, "X");
				Assert.AreEqual (0, bounds.Y, "Y");
				Assert.AreEqual (20, bounds.Width, "Width");
				Assert.AreEqual (20, bounds.Height, "Height");
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:13,代碼來源:TestRegion.cs

示例13: InfinityExclude

		public void InfinityExclude ()
		{
			using (Region r = new Region ()) {
				Assert.IsTrue (r.IsInfinite (graphic), "before");
				r.Exclude (new Rectangle (5, 5, 10, 10));
				Assert.IsFalse (r.IsInfinite (graphic), "after");
				RectangleF bounds = r.GetBounds (graphic);
				Assert.AreEqual (-4194304, bounds.X, "X");
				Assert.AreEqual (-4194304, bounds.Y, "Y");
				Assert.AreEqual (8388608, bounds.Width, "Width");
				Assert.AreEqual (8388608, bounds.Height, "Height");
			}
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:13,代碼來源:TestRegion.cs

示例14: Region_Infinite_MultipleRectangles

		public void Region_Infinite_MultipleRectangles ()
		{
			Region region = new Region ();
			Assert.IsTrue (region.IsInfinite (graphic), "Empty.IsInfinite");

			GraphicsPath gp = new GraphicsPath ();
			gp.AddRectangle (new Rectangle (-4194304, -4194304, 8388608, 8388608));
			region = new Region (gp);
			Assert.IsTrue (region.IsInfinite (graphic), "OneRectangle.IsInfinite");

			gp.AddRectangle (new Rectangle (1, 1, 2, 2));
			region = new Region (gp);
			Assert.IsFalse (region.IsInfinite (graphic), "TwoOverlappingRectangle.IsInfinite");

			gp = new GraphicsPath ();
			gp.AddRectangle (new Rectangle (-4194304, -4194304, 4194304, 8388608));
			gp.AddRectangle (new Rectangle (0, -4194304, 4194304, 8388608));
			Assert.IsFalse (region.IsInfinite (graphic), "TwoSideBySideRectangle.IsInfinite");
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:19,代碼來源:TestRegion.cs

示例15: 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


注:本文中的System.Drawing.Region.IsInfinite方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。