0

左に画像があり、画像のすぐ隣に2つのボタンがあるWPFのウィンドウを設計しました。そして、私はに設定しWindowStateましたMaximized

しかし、アプリケーションの実行中に、ギャップ b/w コントロールが増加しました。設計時のままアライメントが欲しい。windows applicationそのまま取得すると、wpfコントロールが自動的に整列されます。

これを行うのを手伝ってください、wpfが初めてです。Panelsこの問題を解決できますか?

サンプル

<Window x:Class="AnalogCalibrationTool.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Analog Hardware Calibration Tool" 
    Height="500" 
    Width="700" 
    WindowStartupLocation="CenterScreen" 
    WindowStyle="SingleBorderWindow" 
    WindowState="Maximized" 
    ResizeMode="NoResize" SnapsToDevicePixels="True">
<Grid>
    <Image HorizontalAlignment="Left" Margin="84.436,164.428,0,147.763" Name="image1" Stretch="Fill" Width="200" />
    <Button Height="23" Margin="326.634,0,276.639,147.763" Name="button1" VerticalAlignment="Bottom">Button</Button>
    <Button Height="29.997" HorizontalAlignment="Right" Margin="0,0,184.426,144.264" Name="button2" VerticalAlignment="Bottom" Width="75">Button</Button>
</Grid>
</Window>
4

1 に答える 1

0

これを試すことができます:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Rectangle Name="image1" Width="200" Grid.Column="0" Fill="Aqua"  />
    <StackPanel Grid.Column="1" HorizontalAlignment="Left">
        <Button Name="button1" Height="23" Width="60" Content="Button1"/>
        <Button Name="button2" Height="23" Width="60" Content="Button2"/>
    </StackPanel>
</Grid>

サンプルでは、​​長方形がイメージの偽物として使用されています。

于 2013-01-28T08:18:14.883 に答える