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


C# Border.UpdateLayout方法代码示例

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


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

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

示例2: GetRendreable

        public static FrameworkElement GetRendreable(IconVm iconVm, ImageSource sourceIcon, Color color)
        {
            var border = new Border()
            {
                Background = new SolidColorBrush(color),
                Width = iconVm.Width,
                Height = iconVm.Height
            };
            var image = new Image()
            {
                Stretch = Stretch.Uniform,
                Source = sourceIcon,
                Width = iconVm.ImageWidth,
                Height = iconVm.ImageHeight,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment = VerticalAlignment.Center
            };


            border.Child = image;

            border.Measure(new Size(border.Width, border.Height));
            border.Arrange(new Rect(new Size(border.Width, border.Height)));
            border.UpdateLayout();
            return border;
        }
开发者ID:alexsorokoletov,项目名称:ImagePreparator,代码行数:26,代码来源:IconsGenerator.cs

示例3: UpdateLayoutTest

		public void UpdateLayoutTest ()
		{
			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, 90);
			path.Data = r;
			
			path.Fill = new SolidColorBrush (Colors.Red);

			b.UpdateLayout ();
			path.UpdateLayout ();

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


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