首页 > 其他分享 >WPF-后台动态创建窗口添加控件示例

WPF-后台动态创建窗口添加控件示例

时间:2022-10-25 21:56:35浏览次数:62  
标签:控件 示例 label1 window1 动态创建 grid new

            Window window1 = new Window();
            window1.Title = "新窗口";
            window1.Background = Brushes.LightBlue;  // SolidColorBrush brush1 = new SolidColorBrush(Colors.Yellow);

            Grid grid = new Grid();
            Label label1 = new Label();
            label1.Content = "执笔小白";
            label1.FontSize = 20;
            label1.Foreground = Brushes.Red;
            grid.Children.Add(label1);
            window1.Content = grid;

            window1.Show();

 

标签:控件,示例,label1,window1,动态创建,grid,new
From: https://www.cnblogs.com/qq2806933146xiaobai/p/16826490.html

相关文章