WPF 窗体设置
?WPF 當(dāng)窗體最大化時(shí)控件位置的大小調(diào)整:
View Code 1 <Window x:Class="WpfApplication1.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 FontFamily="Consolas,Microsoft Yahei" FontSize="14" 5 Title="MainWindow"> 6 <Grid> 7 <Grid x:Name="Grid1" Margin="10"> 8 <Grid.RowDefinitions> 9 <!-- 將 Grid 分為5行 其中 1、3 作為控件間的間隙 --> 10 <RowDefinition Height="Auto"/> 11 <RowDefinition Height="10"/> 12 <RowDefinition Height="*"/> 13 <!-- 也可以用 Star --> 14 <RowDefinition Height="10"/> 15 <RowDefinition Height="Auto"/> 16 </Grid.RowDefinitions> 17 18 <!-- 最上面一行放置標(biāo)題和命令按鈕 --> 19 <DockPanel Grid.Row="0"> 20 <!-- 位于 0 行的控件可以省略 Grid.Row="0" --> 21 <TextBlock DockPanel.Dock="Left" Text="窗口布局" VerticalAlignment="Center"/> 22 <!-- 在 DockPanel 中最后一個(gè)定義的元素被視為 DockPanel.Dock="Fill" --> 23 <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right"> 24 <Button Content="提交修改" Width="90" Height="23" Name="button1"/> 25 <TextBlock Text=" "/> 26 <!-- 作為 Button 的分隔符 --> 27 <Button Content="增加一列" Width="90" Height="23" Name="button2"/> 28 </StackPanel> 29 </DockPanel> 30 31 <DataGrid Grid.Row="2"/> 32 33 <Label Name="label1" Grid.Row="4"> 34 <TextBlock Text="就緒"/> 35 </Label> 36 </Grid> 37 </Grid> 38 </Window>詳細(xì)知識(shí)參考:?
http://msdn.microsoft.com/zh-cn/library/ms754152.aspx
轉(zhuǎn)載于:https://www.cnblogs.com/ryuu/archive/2012/05/25/2517777.html
總結(jié)
- 上一篇: ZOJ1221 Risk 图形的遍历
- 下一篇: Debian on VirtualBox