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


C# Border.Arrange方法代码示例

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


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

示例1: RenderFrame

        protected override BitmapSource RenderFrame(DataRect dataRect, Rect output)
        {
            Grid grid = new Grid();
            grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            TextBlock lt = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Text = String.Format("({0},{1})", dataRect.XMin, dataRect.YMax)
            };
            grid.Children.Add(lt);
            Grid.SetRow(lt, 0);
            TextBlock rb = new TextBlock
            {
                VerticalAlignment = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Right,
                Text = String.Format("({0},{1})", dataRect.XMax, dataRect.YMin)
            };
            grid.Children.Add(rb);
            Grid.SetRow(rb, 1);
            Border border = new Border();
            border.BorderThickness = new Thickness(3);
            border.BorderBrush = Brushes.Blue;
            border.Child = grid;

            RenderTargetBitmap rtb = new RenderTargetBitmap((int)output.Width, (int)output.Height, 96, 96, PixelFormats.Default);
            border.Measure(new Size(output.Width, output.Height));
            border.Arrange(output);
            rtb.Render(border);

            Thread.Sleep(1000);

            return rtb;
        }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:35,代码来源:Window1.xaml.cs

示例2: BorderHitTestTest

        public void BorderHitTestTest()
        {
            Border border = new Border
            {
                Width = 200,
                Height = 100,
                BorderThickness = new Thickness(10, 20, 30, 40),
                IsRootElement = true,
            };

            border.Measure(Size.Infinity);
            border.Arrange(new Rect(border.DesiredSize));

            BackgroundHitTestTest(border, null);
            BorderHitTestTest(border, null);

            border.Background = Brushes.Transparent;
            border.BorderBrush = null;

            BackgroundHitTestTest(border, border);
            BorderHitTestTest(border, border);

            border.Background = null;
            border.BorderBrush = Brushes.Transparent;

            BackgroundHitTestTest(border, null);
            BorderHitTestTest(border, border);

            border.Background = Brushes.Transparent;
            border.BorderBrush = Brushes.Transparent;

            BackgroundHitTestTest(border, border);
            BorderHitTestTest(border, border);
        }
开发者ID:highzion,项目名称:Granular,代码行数:34,代码来源:BorderTest.cs

示例3: GetPage

        public override DocumentPage GetPage(int pageNumber)
        {
            var page = _pages[pageNumber];

            var container = new Border();
            container.Padding = _margin;
            container.Child = page;
            container.Measure(PageSize);
            container.Arrange(new Rect(PageSize));

            return new DocumentPage(container);
        }
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:12,代码来源:C1RichTextBoxPaginator.cs

示例4: GetThumbnailImage

        public static BitmapSource GetThumbnailImage(this BitmapSource source, double percent, double dpiX, double dpiY)
        {
            double width = source.PixelWidth, height = source.PixelHeight;

            Algorithm.Math.ToPercentSize(percent, ref width, ref height);

            RenderTargetBitmap bmp = new RenderTargetBitmap((int)width, (int)height,
                dpiX, dpiY, PixelFormats.Pbgra32);
            Border image = new Border();
            image.RenderSize = new Size(width, height);
            image.Background = new ImageBrush(source);
            image.Measure(new Size(width, height));
            image.Arrange(new Rect(new Size(width, height)));
            bmp.Render(image);

            return BitmapFrame.Create(bmp);
        }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:17,代码来源:BitmapSourceExtensions.cs

示例5: MouseDeviceButtonTest

        public void MouseDeviceButtonTest()
        {
            Border element = new Border { Background = Brushes.Transparent, Width = 100, Height = 100, IsRootElement = true };
            element.Measure(Size.Infinity);
            element.Arrange(new Rect(element.DesiredSize));

            int eventIndex = 0;
            int previewMouseDownIndex = 0;
            int previewMouseUpIndex = 0;
            int mouseDownIndex = 0;
            int mouseUpIndex = 0;

            element.PreviewMouseDown += (sender, e) => previewMouseDownIndex = ++eventIndex;
            element.PreviewMouseUp += (sender, e) => previewMouseUpIndex = ++eventIndex;
            element.MouseDown += (sender, e) => mouseDownIndex = ++eventIndex;
            element.MouseUp += (sender, e) => mouseUpIndex = ++eventIndex;

            TestPresentationSource presentationSource = new TestPresentationSource();
            presentationSource.RootElement = element;

            MouseDevice mouseDevice = new MouseDevice(presentationSource);

            mouseDevice.Activate();

            mouseDevice.ProcessRawEvent(new RawMouseButtonEventArgs(MouseButton.Left, MouseButtonState.Pressed, new Point(10, 10), 0));
            Assert.AreEqual(MouseButtonState.Pressed, mouseDevice.GetButtonState(MouseButton.Left));
            Assert.AreEqual(1, previewMouseDownIndex);
            Assert.AreEqual(2, mouseDownIndex);

            mouseDevice.ProcessRawEvent(new RawMouseButtonEventArgs(MouseButton.Left, MouseButtonState.Released, new Point(10, 10), 0));
            Assert.AreEqual(MouseButtonState.Released, mouseDevice.GetButtonState(MouseButton.Left));
            Assert.AreEqual(3, previewMouseUpIndex);
            Assert.AreEqual(4, mouseUpIndex);

            mouseDevice.ProcessRawEvent(new RawMouseButtonEventArgs(MouseButton.Left, MouseButtonState.Pressed, new Point(10, 10), 0));
            Assert.AreEqual(MouseButtonState.Pressed, mouseDevice.GetButtonState(MouseButton.Left));
            Assert.AreEqual(5, previewMouseDownIndex);
            Assert.AreEqual(6, mouseDownIndex);

            mouseDevice.Deactivate();
            Assert.AreEqual(MouseButtonState.Released, mouseDevice.GetButtonState(MouseButton.Left));
            Assert.AreEqual(7, previewMouseUpIndex);
            Assert.AreEqual(8, mouseUpIndex);
        }
开发者ID:highzion,项目名称:Granular,代码行数:44,代码来源:MouseDeviceTest.cs

示例6: MeasureRectangleBorderTest1

		public void MeasureRectangleBorderTest1 ()
		{
			// See 1_1 1_2 for demonstation of this as a measure invalidation bug.
			Border b = new Border ();
			Path p = new Path ();
			p.Fill = new SolidColorBrush (Colors.Black);
			RectangleGeometry r = new RectangleGeometry ();
			r.Rect = new Rect (10, 10, 20, 20);
			p.Data = r;
			b.Child = p;

			b.Measure (new Size (50, 50));
			b.Arrange (new Rect (0, 0, 50, 50));

			Assert.AreEqual (new Size (0,0), b.DesiredSize, "b desired");
			Assert.AreEqual (new Size (50,50), b.RenderSize, "b RenderSize");
			Assert.AreEqual (new Size (0,0), p.DesiredSize, "p DesiredSize");
			Assert.AreEqual (new Size (50,50), p.RenderSize, "p RenderSize");
		}
开发者ID:dfr0,项目名称:moon,代码行数:19,代码来源:PathTest.cs

示例7: MeasureRectangleBorderTest1_1

		public void MeasureRectangleBorderTest1_1 ()
		{
			// This is the same as the above test but has
			Border b = new Border ();
			Path p = new Path ();
			b.Child = p;
			p.Fill = new SolidColorBrush (Colors.Black);
			RectangleGeometry r = new RectangleGeometry ();
			r.Rect = new Rect (10, 10, 20, 20);
			p.Data = r;

			b.Measure (new Size (50, 50));
			b.Arrange (new Rect (0, 0, 50, 50));

			Assert.AreEqual (new Size (30,30), b.DesiredSize, "b desired");
			Assert.AreEqual (new Size (30,30), p.DesiredSize, "p desired");
			Assert.AreEqual (new Size (50,50), b.RenderSize, "b RenderSize");
			Assert.AreEqual (new Size (50,50), p.RenderSize, "p RenderSize");
		}
开发者ID:dfr0,项目名称:moon,代码行数:19,代码来源:PathTest.cs

示例8: BorderRenderTest

        public void BorderRenderTest()
        {
            Brush backgroundBrush = new LinearGradientBrush(30, Colors.Blue, Colors.Green);
            Brush borderBrush = new LinearGradientBrush(-30, Colors.Red, Colors.Blue);
            Thickness borderThickness = new Thickness(10, 20, 30, 40);

            Border border = new Border
            {
                Child = new FrameworkElement { Width = 200, Height = 100 },
                Background = backgroundBrush,
                BorderBrush = borderBrush,
                BorderThickness = borderThickness,
            };

            border.Measure(Size.Infinity);
            border.Arrange(new Rect(border.DesiredSize));

            IRenderElementFactory factory = TestRenderElementFactory.Default;

            border.GetRenderElement(factory);

            Assert.AreEqual(new Rect(240, 160), border.GetRenderElement(factory).Bounds);

            Assert.AreEqual(2, border.GetRenderElement(factory).Children.Count());

            IBorderRenderElement borderRenderElement = border.GetRenderElement(factory).Children.ElementAt(0) as IBorderRenderElement;
            Assert.IsNotNull(borderRenderElement);
            Assert.AreEqual(backgroundBrush, borderRenderElement.Background);
            Assert.AreEqual(borderBrush, borderRenderElement.BorderBrush);
            Assert.AreEqual(borderThickness, borderRenderElement.BorderThickness);
            Assert.AreEqual(new Rect(240, 160), borderRenderElement.Bounds);

            IVisualRenderElement visualRenderElement = border.GetRenderElement(factory).Children.ElementAt(1) as IVisualRenderElement;
            Assert.IsNotNull(visualRenderElement);
            Assert.AreEqual(new Rect(10, 20, 200, 100), visualRenderElement.Bounds);

            border.Child = null;
            Assert.AreEqual(1, border.GetRenderElement(factory).Children.Count());
        }
开发者ID:highzion,项目名称:Granular,代码行数:39,代码来源:BorderTest.cs

示例9: LayoutSlotTest4InTree

		public void LayoutSlotTest4InTree ()
		{
			Border b = new Border ();
			var stack = new StackPanel ();

			var panel = new Grid ();
			panel.Children.Add (b);

			panel.Background = new SolidColorBrush (Colors.Green);

			stack.Children.Add (CreateSlotItem ());
			stack.Children.Add (CreateSlotItem ());
  			stack.Children.Add (CreateSlotItem ());
			stack.HorizontalAlignment = HorizontalAlignment.Right;
			b.Width = 50;
			b.Child = stack;

			b.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
			Assert.AreEqual (new Size (0,0), new Size (stack.ActualWidth, stack.ActualHeight), "stack actual");

			b.Arrange (new Rect (0,0,b.DesiredSize.Width,b.DesiredSize.Height));
			
			Assert.AreEqual (new Rect (0,0,25,33).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[0]).ToString (), "slot0");
			Assert.AreEqual (new Rect (0,33,25,33).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[1]).ToString (), "slot1");
			Assert.AreEqual (new Rect (0,66,25,33).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[2]).ToString (), "slot2");
			Assert.AreEqual (new Rect (0,0,50,99).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack).ToString ());
			Assert.AreEqual (new Rect (0,0,50,99).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)b).ToString ());
			
			Assert.AreEqual (new Size (50,99),b.DesiredSize);
			Assert.AreEqual (new Size (25,99),stack.DesiredSize);
			Assert.AreEqual (new Size (25,99), new Size (stack.ActualWidth, stack.ActualHeight), "stack actual");

			TestPanel.Children.Add (panel);
			Assert.AreEqual (new Size (0,0),b.DesiredSize);
			Assert.AreEqual (new Size (0,0),stack.DesiredSize);

			b.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
			Assert.AreEqual (new Size (0,0), new Size (stack.ActualWidth, stack.ActualHeight), "stack actual");
			b.Arrange (new Rect (0,0,b.DesiredSize.Width,b.DesiredSize.Height));

			Assert.AreEqual (new Rect (0,0,0,0).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[0]).ToString (), "slot0 in tree");
			Assert.AreEqual (new Rect (0,0,0,0).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[1]).ToString (), "slot1 in tree");
			Assert.AreEqual (new Rect (0,0,0,0).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[2]).ToString (), "slot2 in tree");
			Assert.AreEqual (new Rect (0,0,0,0).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack).ToString ());
			Assert.AreEqual (new Rect (0,0,0,0).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)b).ToString ());
			Assert.AreEqual (new Size (50,99),b.DesiredSize);
			Assert.AreEqual (new Size (25,99),stack.DesiredSize);
			TestPanel.Children.Remove (panel);

			CreateAsyncTest (panel, () => {
					Assert.AreEqual (new Rect (0,0,25,33).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[0]).ToString (), "slot0");
					Assert.AreEqual (new Rect (0,33,25,33).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[1]).ToString (), "slot1");
					Assert.AreEqual (new Rect (0,66,25,33).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[2]).ToString (), "slot2");
					Assert.AreEqual (new Rect (0,0,50,TestPanel.ActualHeight).ToString (), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack).ToString (), "slot3");
					Assert.AreEqual(new Rect(0, 0, TestPanel.ActualWidth, TestPanel.ActualHeight).ToString(), LayoutInformation.GetLayoutSlot((FrameworkElement)b).ToString(), "slot4");

					Assert.AreEqual (new Size (50,99),b.DesiredSize, "b desired async");
					Assert.AreEqual (new Size (25,99),stack.DesiredSize, "stack desired async");
				});
		}
开发者ID:dfr0,项目名称:moon,代码行数:60,代码来源:StackPanelTest.cs

示例10: ArrangeTooLongLineTest

		public void ArrangeTooLongLineTest ()
		{
			Border b = new Border ();
			TextBlock tb = new TextBlock ();
			tb.Text = "Hello and don't you forget Who I am";
			
			b.Child = tb;
			b.Width = 44;
			
			Assert.IsTrue (tb.ActualWidth > 192.8 && tb.ActualWidth < 202.4, "1. textblock.ActualWidth is " + tb.ActualWidth.ToString ());
			Assert.AreEqual (1, GetLineCount (tb.ActualHeight), "1. line count based on textblock.ActualHeight");
			//Assert.IsTrue (tb.ActualWidth < 202.4 && tb.ActualWidth > 202.3, "1. tb.ActualWidth is " + tb.ActualWidth.ToString ());
			//Assert.AreEqual (16, tb.ActualHeight, "1. tb.ActualHeight");

			b.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
			
			Assert.IsTrue (tb.ActualWidth > 192.8 && tb.ActualWidth < 202.4, "2. textblock.ActualWidth is " + tb.ActualWidth.ToString ());
			Assert.AreEqual (1, GetLineCount (tb.ActualHeight), "2. line count based on textblock.ActualHeight");
			Assert.AreEqual (1, GetLineCount (tb.DesiredSize.Height), "2. line count based on textblock.DesiredSize");
			Assert.AreEqual (1, GetLineCount (b.DesiredSize.Height), "2. line count based on border.DesiredSize");
			//Assert.AreEqual (new Size (44,16), tb.DesiredSize, "2. tb.DesiredSize");
			//Assert.AreEqual (new Size (44,16), b.DesiredSize, "2. b.DesiredSize");
			//Assert.IsTrue (tb.ActualWidth < 202.4 && tb.ActualWidth > 202.3, "2. tb.ActualWidth is " + tb.ActualWidth.ToString ());
			//Assert.AreEqual (16, tb.ActualHeight, "2. tb.ActualHeight");

			b.Arrange (new Rect (0,0, b.DesiredSize.Width, b.DesiredSize.Height));
			
			Assert.IsTrue (tb.ActualWidth > 192.8 && tb.ActualWidth < 202.4, "3. tb.ActualWidth is " + tb.ActualWidth.ToString ());
			Assert.AreEqual (1, GetLineCount (tb.ActualHeight), "3. line count based on textblock.ActualHeight");
			Assert.AreEqual (1, GetLineCount (tb.DesiredSize.Height), "3. line count based on textblock.DesiredSize");
			Assert.AreEqual (1, GetLineCount (b.ActualHeight), "3. line count based on border.ActualHeight");
			Assert.AreEqual (1, GetLineCount (b.DesiredSize.Height), "3. line count based on border.DesiredSize");
			//Assert.AreEqual (new Size (44,16), tb.DesiredSize, "3. tb.DesiredSize");
			//Assert.AreEqual (new Size (44,16), b.DesiredSize, "3. b.DesiredSize");
			//Assert.IsTrue (tb.ActualWidth > 202.3 && tb.ActualWidth < 202.4,"3. tb.ActualWidth is " + tb.ActualWidth.ToString ());
			//Assert.AreEqual (16, tb.ActualHeight, "3. tb.ActualHeight");
			//Assert.AreEqual (new Size (44,16), new Size (b.ActualWidth, b.ActualHeight), "3. b.Actual*");
		}
开发者ID:kangaroo,项目名称:moon,代码行数:38,代码来源:TextBlockTest.cs

示例11: LayoutSlotTest2

		public void LayoutSlotTest2 ()
		{
			Border b = new Border ();
			var stack = new StackPanel ();
			stack.Children.Add (CreateSlotItem ());
			stack.Children.Add (CreateSlotItem ());
			stack.Children.Add (CreateSlotItem ());
			b.Width = 50;
			b.Height = 300;
			b.Child = stack;

			b.Measure (new Size (Double.PositiveInfinity, Double.PositiveInfinity));
			b.Arrange (new Rect (0,0,b.DesiredSize.Width,b.DesiredSize.Height));
			
			Assert.AreEqual (new Rect (0,0,50,33), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[0]));
			Assert.AreEqual (new Rect (0,33,50,33), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[1]));
			Assert.AreEqual (new Rect (0,66,50,33), LayoutInformation.GetLayoutSlot ((FrameworkElement)stack.Children[2]));
			
			Assert.AreEqual (new Size (50,300),b.DesiredSize);
			Assert.AreEqual (new Size (50,300),b.RenderSize);
			
		}
开发者ID:dfr0,项目名称:moon,代码行数:22,代码来源:StackPanelTest.cs

示例12: UpdateShadow


//.........这里部分代码省略.........
                                container.Children.Add(cylinder);
                            }
                        }
                    }
                }

                #endregion
            }

            // Get bounding box
            Rect3D boundingBox = VisualTreeHelper.GetDescendantBounds(container);
            if (boundingBox.IsEmpty)
            {
                shadowRefreshStarted = false;
                return;
            }

            #region Render Shadow

            const double blurSize = 25;
            const int renderTargetWidth = 200;
            int renderTargetHeight = (int)(200.0 * (boundingBox.SizeX / boundingBox.SizeY));
            RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(renderTargetWidth, renderTargetHeight, 96, 96, PixelFormats.Pbgra32);

            Viewport3D shadowViewport3D = new Viewport3D();
            Border border = new Border();
            border.Padding = new Thickness(blurSize);
            border.Child = shadowViewport3D;

            // Change size of the visualizer
            border.Width = renderTargetBitmap.PixelWidth;
            border.Height = renderTargetBitmap.PixelHeight;
            border.Measure(new Size(renderTargetBitmap.PixelWidth, renderTargetBitmap.PixelHeight));
            border.Arrange(new Rect(0, 0, renderTargetBitmap.PixelWidth, renderTargetBitmap.PixelHeight));

            shadowViewport3D.Children.Add(container);

            // Create camera
            OrthographicCamera orthographicCamera = new OrthographicCamera();

            #region Accomodate camera to fit content

            orthographicCamera.Position = new Point3D(boundingBox.Location.X + boundingBox.SizeX / 2.0,
                                                      boundingBox.Location.Y,
                                                      boundingBox.Location.Z + boundingBox.SizeZ / 2.0);
            orthographicCamera.LookDirection = new Vector3D(0, 1, 0);
            orthographicCamera.UpDirection = new Vector3D(-1, 0, 0);
            orthographicCamera.Width = boundingBox.SizeZ;

            #endregion

            orthographicCamera.NearPlaneDistance = 0;

            // Set the camera & correct lights
            shadowViewport3D.Camera = orthographicCamera;

            BlurEffect blurEffect = new BlurEffect();
            blurEffect.Radius = blurSize;

            border.Effect = blurEffect;

            renderTargetBitmap.Render(border);
            renderTargetBitmap.Freeze();

            #endregion
开发者ID:AnthonyNystrom,项目名称:NuGenBioChemDX,代码行数:66,代码来源:Visualizer.xaml.cs

示例13: drawHeaderForBox

        // Assumes that the bitmapcontext is active
        private void drawHeaderForBox(WriteableBitmap bitmap, int x, int y, int width, String text)
        {
            const int BOX_HEIGHT = 40;
            const int BOX_WIDTH = 120;

            TranslateTransform transform = new TranslateTransform();
            transform.X = x + (width - BOX_WIDTH) / 2;
            transform.Y = y;

            Border border = new Border();
            border.Height = BOX_HEIGHT;
            border.Width = BOX_WIDTH;
            border.Background = new SolidColorBrush(Color.FromArgb(128, 0, 0, 0));

            TextBlock textBlock = new TextBlock();
            textBlock.FontSize = 36;
            textBlock.TextAlignment = TextAlignment.Center;
            textBlock.Foreground = new SolidColorBrush(Colors.White);
            textBlock.Text = text;

            border.Child = textBlock;
            border.Arrange(new Rect(0.0, 0.0, border.Width, border.Height));
            border.UpdateLayout();

            bitmap.Render(border, transform);
        }
开发者ID:viperium,项目名称:WatchDogWP8,代码行数:27,代码来源:CalibrationScreen.xaml.cs

示例14: Arrange_Rounding

		public void Arrange_Rounding()
		{
			Border b = new Border ();
			var path = new Path ();
			//var canvas = new Canvas ();
			b.Child = path;
			//canvas.Children.Add (b);
			RectangleGeometry r = new RectangleGeometry ();
			r.Rect = new Rect (10, 10, 80.1, .2);
			path.Data = r;
			
			path.Width = 20;
			path.Height = 20;
			path.Fill = new SolidColorBrush (Colors.Red);

			b.Measure (new Size (120, 120));
			Assert.IsTrue (path.UseLayoutRounding, "path rounds?");
			Assert.AreEqual (new Size (20,20), path.DesiredSize, "desired");
			Assert.AreEqual (new Size (0,0), path.RenderSize, "render");
			Assert.AreEqual (0, path.ActualWidth);
			Assert.AreEqual (0, path.ActualHeight);

			b.Arrange (new Rect (0, 0, 120, 120));

			Assert.AreEqual (new Size (20,20), path.DesiredSize, "desired");
			Assert.AreEqual (new Size (90,20), path.RenderSize, "render");
			Assert.AreEqual (90, path.ActualWidth);
			Assert.AreEqual (20, path.ActualHeight);
		}
开发者ID:dfr0,项目名称:moon,代码行数:29,代码来源:PathTest.cs

示例15: MeasureRectangleBorderTest1_2

		public void MeasureRectangleBorderTest1_2 ()
		{
			// See test 1_1 and 1 for more information
			Border b = new Border ();
			Path p = new Path ();
			p.Fill = new SolidColorBrush (Colors.Black);
			RectangleGeometry r = new RectangleGeometry ();
			r.Rect = new Rect (10, 10, 20, 20);
			p.Data = r;
			b.Child = p;

			p.InvalidateMeasure ();
			b.Measure (new Size (50, 50));
			b.Arrange (new Rect (0, 0, 50, 50));

			Assert.AreEqual (new Size (30,30), b.DesiredSize, "b desired");
			Assert.AreEqual (new Size (30,30), p.DesiredSize, "p DesiredSize");
			Assert.AreEqual (new Size (50,50), b.RenderSize, "b RenderSize");
			Assert.AreEqual (new Size (50,50), p.RenderSize, "p RenderSize");
		}
开发者ID:dfr0,项目名称:moon,代码行数:20,代码来源:PathTest.cs


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