8,756
社区成员




<Grid x:Name="LayoutRoot" Background="Snow">
<StackPanel x:Name="dddd"></StackPanel>
</Grid>
TextBlock tb;
Brush brush;
for (int i = 0; i < 5; i++)
{
brush = new SolidColorBrush(Color.FromArgb(255, (byte)i, (byte)(10+i), 200));
tb = new TextBlock();
tb.SetValue(TextBlock.ForegroundProperty, brush);
tb.Text = "控件" + i;
tb.Width = 100;
tb.Height = 50;
dddd.Children.Add(tb);
}
TextBlock _textBlk = new TextBlock();
_textBlk.SetValue(NameProperty, "textBlock1");
_textBlk.Text = "Hello";
this.Children.Add(_textBlk);