首页 > 编程知识 正文

wpf风格,wpf自适应布局

时间:2023-05-04 22:54:49 阅读:206242 作者:4094

注意:Margin是边距

<Window x:Class="WpfApp1.Window1" 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:WpfApp1" mc:Ignorable="d" Title="Grid" Height="508" Width="800" WindowStartupLocation="CenterOwner"> <Grid Margin="0,0,3.6,0"> <Grid.ColumnDefinitions> <ColumnDefinition Width="50*"/> <ColumnDefinition Width="50*"/> <ColumnDefinition Width="50*"/> <ColumnDefinition Width="50*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="50*"/> <RowDefinition Height="50*"/> <RowDefinition Height="50*"/> <RowDefinition Height="50*"/> </Grid.RowDefinitions> <Label x:Name="label" Content="告诉我你的梦想是什么" FontSize="14" Height="40" Margin="20,10,10,10" Grid.Row="0" Grid.Column="0"/> <Label x:Name="label1" Content="疯狂的暗示->>>>" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="0" Grid.Column="1"/> <Label x:Name="label2" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="1" Grid.Column="0"/> <Label x:Name="label3" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="1" Grid.Column="1"/> <Label x:Name="label4" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="1" Grid.Column="2"/> <Label x:Name="label5" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="0" Grid.Column="2"/> <Label x:Name="label6" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="0" Grid.Column="3"/> <Label x:Name="label7" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="1" Grid.Column="3"/> <Label x:Name="label8" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="1" Grid.Column="3"/> <Label x:Name="label9" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="2" Grid.Column="0"/> <Label x:Name="label10" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="2" Grid.Column="1"/> <Label x:Name="label11" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="2" Grid.Column="2"/> <Label x:Name="label12" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="2" Grid.Column="3"/> <Label x:Name="label13" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="3" Grid.Column="0"/> <Label x:Name="label14" Content="摸鱼" FontSize="15" Height="40" Margin="40,10,10,10" Grid.Row="3" Grid.Column="1"/> <Button x:Name="button1" Content="MSDN" HorizontalAlignment="Center" Click="button1_Click" Width="128" Grid.Row="3" Grid.Column="2" Margin="5,30,5,30"/> <GroupBox Header="请选择你的梦想" BorderBrush="Black" Margin="10" Grid.Row="3" Grid.Column="4"> <StackPanel Margin="5"> <CheckBox Content="摸鱼"/> <CheckBox Content="touch fish"/> <CheckBox Content="mo yv "/> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Button x:Name="button2" Content="go" Width="40" Margin="5" /> <Button x:Name="button3" Content="movew" Width="40" Margin="5"/> </StackPanel> </StackPanel> </GroupBox> </Grid> </Window>

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。