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


C# Path.Measure方法代碼示例

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


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

示例1: MeasureRectangleTest1

		public void MeasureRectangleTest1 ()
		{
			Path p = new Path ();
			RectangleGeometry r = new RectangleGeometry ();
			r.Rect = new Rect (10, 10, 20, 20);
			p.Data = r;

			p.Measure (new Size (50, 50));

			Assert.AreEqual (new Size (0, 0), p.DesiredSize);
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:11,代碼來源:PathTest.cs

示例2: ComputeActualWidth

		public void ComputeActualWidth ()
		{
			var c = new Path ();

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0");

			c.MaxWidth = 25;
			c.Width = 50;
			c.MinHeight = 33;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot1");

			c.Measure (new Size (100, 100));

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired2");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2");

			c.Arrange (new Rect (0,0,c.DesiredSize.Width,c.DesiredSize.Height));

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired3");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual3");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render3");
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:27,代碼來源:PathTest.cs

示例3: ComputeSizeInfinite_StretchUniform_InstrinsicBorder

		public void ComputeSizeInfinite_StretchUniform_InstrinsicBorder ()
		{
			Border b = new Border ();
			var c = new Path ();
			b.Child = c;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0");

			var data = new RectangleGeometry ();
			data.Rect = new Rect (0,10,25,23);
			c.Data = data;
			c.Stretch = Stretch.Uniform;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot");

			c.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));

			Assert.AreEqual (new Size (25,23), c.DesiredSize, "c desired2");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2");

			c.Arrange (new Rect (10,10,c.DesiredSize.Width,c.DesiredSize.Height));

			Assert.AreEqual (new Size (25,23), c.DesiredSize, "c desired");
			Assert.AreEqual (new Size (25,23), c.DesiredSize, "c desired");
			Assert.AreEqual (new Size (25,23), new Size (c.ActualWidth,c.ActualHeight), "c actual3");
			Assert.AreEqual (new Size (25,23), c.RenderSize, "c render");
			Assert.AreEqual (new Rect (10,10,25,23), LayoutInformation.GetLayoutSlot (c), "c slot2");
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:33,代碼來源:PathTest.cs

示例4: ComputeReducedSize_StretchUniform_InstrinsicBorder_InTree

		public void ComputeReducedSize_StretchUniform_InstrinsicBorder_InTree ()
		{
			Border b = new Border ();
			b.UseLayoutRounding = true;
			var c = new Path ();
			b.Child = c;

			b.Width = 10;
			b.Height = 10;

			Assert.IsTrue (c.UseLayoutRounding, "use rounding");
			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0");

			var data = new RectangleGeometry ();
			data.Rect = new Rect (0,10,25,23);
			c.Data = data;
			c.Stretch = Stretch.Uniform;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot");

			c.Measure (new Size (10, 10));

			Assert.AreEqual (new Size (10,9), c.DesiredSize, "c desired2");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2");

			c.Arrange (new Rect (10,10,c.DesiredSize.Width,c.DesiredSize.Height));

			CreateAsyncTest (b, () => {
					Assert.AreEqual (new Rect (0,0,10,10), LayoutInformation.GetLayoutSlot (c), "c slot2");
					Assert.AreEqual (new Size (10,9), c.DesiredSize, "c desired");
					Assert.AreEqual (c.RenderSize, new Size (c.ActualWidth, c.ActualHeight), "render == actual");
					Assert.AreEqual (10, c.ActualWidth, "c.ActualWidth == " + c.ActualWidth.ToString ());
					Assert.IsTrue (c.ActualHeight > 9 && c.ActualHeight < 9.2, "c actual.height == " + c.ActualHeight.ToString ());
				});
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:40,代碼來源:PathTest.cs

示例5: ComputeLargerSize_StretchUniform_IntrinsicBorder

		public void ComputeLargerSize_StretchUniform_IntrinsicBorder ()
		{
			Border b = new Border ();
			var c = new Path ();
			b.Child = c;
			c.Stretch = Stretch.Uniform;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0");

			var data = new RectangleGeometry ();
			data.Rect = new Rect (0,10,25,23);
			c.Data = data;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot");

			c.Measure (new Size (100, 100));

			Assert.AreEqual (new Size (100,92), c.DesiredSize, "c desired2");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2");

			c.Arrange (new Rect (8,6,c.DesiredSize.Width,c.DesiredSize.Height));

			Assert.AreEqual (new Size (100,92), c.DesiredSize, "c desired3");
			Assert.AreEqual (new Size (100,92), new Size (c.ActualWidth,c.ActualHeight), "c actual3");
			Assert.AreEqual (new Size (100,92), c.RenderSize, "c render3");
			Assert.AreEqual (new Rect (8,6,100,92), LayoutInformation.GetLayoutSlot (c), "c slot3");

		}
開發者ID:dfr0,項目名稱:moon,代碼行數:33,代碼來源:PathTest.cs

示例6: ComputeRestrainedSizeIntrinsicBorder

		public void ComputeRestrainedSizeIntrinsicBorder ()
		{
			Border b = new Border ();
			var c = new Path ();
			b.Child = c;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0");

			var data = new RectangleGeometry ();
			data.Rect = new Rect (0,10,25,23);
			c.Data = data;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot");

			c.Measure (new Size (10, 10));

			Assert.AreEqual (new Size (10,10), c.DesiredSize, "c desired2");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot2");

			c.Arrange (new Rect (10,10,c.DesiredSize.Width,c.DesiredSize.Height));

			Assert.AreEqual (new Size (10,10), c.DesiredSize, "c desired");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual3");
			Assert.AreEqual (new Size (25,33), c.RenderSize, "c render");
			Assert.AreEqual (new Rect (10,10,10,10), LayoutInformation.GetLayoutSlot (c), "c slot2");

		}
開發者ID:dfr0,項目名稱:moon,代碼行數:32,代碼來源:PathTest.cs

示例7: ComputeActualSizeIntrinsic

		public void ComputeActualSizeIntrinsic ()
		{
			var c = new Path ();

			//Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired");
			//Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1");

			var data = new RectangleGeometry ();
			data.Rect = new Rect (0,10,25,23);
			c.Data = data;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot");

			c.Measure (new Size (100, 100));

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render");

			c.Arrange (new Rect (0,0,c.DesiredSize.Width,c.DesiredSize.Height));

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual3");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render");
		}
開發者ID:dfr0,項目名稱:moon,代碼行數:27,代碼來源:PathTest.cs


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