01-WPF布局

 今天是我学习WPF的第一天,今天主要学习了,布局控件,具体学习的控件内容如下。

例如:Grid,stackpanel,WrapPanel,DockPanel,UniformGrid,今天根据所学内容实践下以下图形布局,主要是为了熟悉布局控件的使用方法,只做大框架布局,不做详细布局,根据以下图形进行框架布局。

具体布局代码如下所示:

<Window x:Class="test.login"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:test"
        mc:Ignorable="d"
        Title="布局案例" Height="800" Width="1200" WindowStartupLocation="CenterScreen"  Background="#F4F2F5" ResizeMode="NoResize" WindowStyle="None">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="136"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" Background="#FFFDFF"/>
        <Grid Grid.Row="1" ShowGridLines="False">
            <Grid.RowDefinitions>
                <RowDefinition Height="170"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Border Background="#2C9FF8" Grid.Column="0" Margin="18,36,18,36"/>
            <Border Background="#69C929" Grid.Column="1" Margin="18,36,18,36"/>
            <Border Background="#FDA005" Grid.Column="2" Margin="18,36,18,36"/>
            <Border Background="#3EC4C3" Grid.Column="3" Margin="18,36,18,36"/>
            <Border Background="#DF6F6E" Grid.Column="4" Margin="18,36,18,36"/>
            <Grid Grid.Row="1" Grid.ColumnSpan="2">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Border Grid.Row="0" Grid.ColumnSpan="2" Background="#FFFDFF" Margin="18"/>
                <Border Grid.Row="1" Grid.Column="0" Background="#FFFDFF" Margin="18"/>
                <Border Grid.Row="1" Grid.Column="1" Background="#FFFDFF" Margin="18"/>
                <Border Grid.Row="2" Grid.Column="0" Background="#FFFDFF" Margin="18"/>
                <Border Grid.Row="2" Grid.Column="1" Background="#FFFDFF" Margin="18"/>
            </Grid>
            <Grid Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="3">
                <Grid.RowDefinitions>
                    <RowDefinition Height="310"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Border Background="#FFFDFF" Margin="18"/>
                <Border Background="#FFFDFF" Grid.Column="1" Margin="18"/>
                <Border Background="#FFFDFF" Margin="18,0,18,18" Grid.Row="1" Grid.ColumnSpan="2"/>
            </Grid>
        </Grid>
    </Grid>
</Window>

根据实践,具体代码运行效果如下(不喜勿喷)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值