DockPanel控件的使用

<Window x:Class="DockPanel控件的使用.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="DockPanel控件的使用" Height="350" Width="525">
    <DockPanel LastChildFill="True">
        <!--使用Border在TextBlock元素的周围绘制边框和背景-->
        <Border Height="25" Background="SkyBlue" BorderBrush="Black"
                BorderThickness="1" DockPanel.Dock="Top">
            <!--用TextBlock显示文本内容-->
            <TextBlock Foreground="Black" Margin="3">1.停靠在顶端</TextBlock>
        </Border>
        <Border Background="LightPink" BorderBrush="Black" BorderThickness="1"
                DockPanel.Dock="Left">
            <TextBlock Foreground="Black" Margin="3">2.停靠在左侧</TextBlock>
        </Border>
        <Border Background="LemonChiffon" BorderBrush="Black" BorderThickness="1"
                DockPanel.Dock="Right">
            <TextBlock Foreground="Black" Margin="3">3.停靠在右侧</TextBlock>
        </Border>
        <Border Background="PaleGreen" Height="25" BorderBrush="Black"
                BorderThickness="1" DockPanel.Dock="Bottom">
            <TextBlock Foreground="Black" Margin="3">4.停靠在底部</TextBlock>
        </Border>
        <Border Height="25" Background="LightSalmon" BorderBrush="Black"
                BorderThickness="1" DockPanel.Dock="Bottom">
            <TextBlock Foreground="Black" Margin="3">5.停靠在底部</TextBlock>
        </Border>
        <Border Background="White" BorderBrush="Black" BorderThickness="1">
            <TextBlock Foreground="Black" Margin="3">6.填充剩余空间</TextBlock>
        </Border>
    </DockPanel>
</Window>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值