嘿,我一直在尝试寻找如何在用户屏幕大于默认大小时自动调整网格控件中的控件大小的示例。
目前,当我放大表单时,我无法调整控件的大小。当前是否有任何代码可以找到网格内的所有控件并在调整表单大小时即时调整它们的大小?
我目前的代码是:
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="768" Width="1024">
<Grid>
<Grid Height="115" Margin="190,0,195,145" Name="Grid1" VerticalAlignment="Bottom" Background="Cyan">
<Button Height="45" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Button4" VerticalAlignment="Top">Button</Button>
<Button Height="45" HorizontalAlignment="Left" Margin="101,10,0,0" Name="Button5" VerticalAlignment="Top">Button</Button>
<Button Height="45" HorizontalAlignment="Left" Margin="192,10,0,0" Name="Button6" VerticalAlignment="Top">Button</Button>
<Button Height="45" HorizontalAlignment="Right" Margin="280,10,257,0" Name="Button7" VerticalAlignment="Top">Button</Button>
<Button Height="45" HorizontalAlignment="Right" Margin="0,10,166,0" Name="Button8" VerticalAlignment="Top">Button</Button>
<Button Height="45" HorizontalAlignment="Right" Margin="0,10,75,0" Name="Button9" VerticalAlignment="Top">Button</Button>
<Button Height="45" HorizontalAlignment="Left" Margin="10,0,0,9" Name="Button10" VerticalAlignment="Bottom">Button</Button>
<Button Height="45" HorizontalAlignment="Left" Margin="101,0,0,9" Name="Button11" VerticalAlignment="Bottom">Button</Button>
<Button Height="45" HorizontalAlignment="Left" Margin="192,0,0,9" Name="Button12" VerticalAlignment="Bottom">Button</Button>
<Button Height="45" HorizontalAlignment="Right" Margin="280,0,257,9" Name="Button13" VerticalAlignment="Bottom">Button</Button>
<Button Height="45" HorizontalAlignment="Right" Margin="0,0,166,9" Name="Button14" VerticalAlignment="Bottom">Button</Button>
<Button Height="45" HorizontalAlignment="Right" Margin="0,0,75,9" Name="Button15" VerticalAlignment="Bottom">Button</Button>
</Grid>
</Grid>
</Window>
任何帮助都会很棒!谢谢!