本文整理汇总了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);
}
示例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;
}
示例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);
}