WPF 窗体布局

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33538554/article/details/53259028

C/S   WPF (简介,案例,源码,截图)

WPF布局简介:

wpf中如果不进行控件布局的设置,我们做出的应用调整窗口大小以后不能随窗体的大小而变化。

WPF布局案例:

TextBox---随窗体的变化而变化,布局---两行两列

源码:

<Window x:Class="OscarSystemV2012.Views.CustomerSystem.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1" Height="300" Width="300">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBox Grid.Row="0"  Grid.Column="0" Background="Yellow"></TextBox>
                <TextBox Grid.Row="0"  Grid.Column="1" Background="Yellow"></TextBox>
                <TextBoxGrid.Row="1"  Grid.Column="0" Background="Yellow"></TextBox>
                <TextBox Grid.Row="1"  Grid.Column="1" Background="Yellow"></TextBox>
            </Grid>
        </Window>

截图:






猜你喜欢

转载自blog.csdn.net/qq_33538554/article/details/53259028
今日推荐