05-Border控件的使用

border控件一般不会自己独立使用 一般是结合其他的控件一起使用

我们添加一个Border控件 把它放在Grid控件的下级

同时 把StackPanel包裹住 这样 我们就可以给StackPanel进行设置它的边框了

设置BorderThickness来这种边框厚度 设置BorderBrush来设置颜色 设置BackGround设置背景颜色

padding 可以设置内边距

CornerRadius设置圆角弧度

<Border BorderBrush="#FF73C146" BorderThickness="33,34,12,45" Padding="12" CornerRadius="11" >
    <StackPanel Background="#FFCB2424" Orientation="Horizontal" Margin="10" HorizontalAlignment="Right">
        <Button x:Name="button" Content="Button" Width="80" Height="30" HorizontalAlignment="Left"/>
        <Button x:Name="button1" Content="Button1"  Width="80" Height="30" HorizontalAlignment="Right"/>
        <Button x:Name="button2" Content="Button2"  Width="80" Height="30"/>
        <Button x:Name="button3" Content="Button3" Width="80" Height="30"/>
        <Button x:Name="button4" Content="Button4" HorizontalAlignment="Left" Width="80" Height="30" MinHeight="40"/>
        <Button x:Name="button5" Content="Button5" Width="80" Height="30" VerticalAlignment="Top"/>
    </StackPanel>
</Border>Code language: HTML, XML (xml)

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注