这就是我的程序在我的编辑器中的样子
这是我的程序正在运行的平板电脑的屏幕截图。
所述代码的xaml是这个
<Window x:Class="DLIUnitLibrary_WPF.ConfigureWindowLandscape"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DLIUnitLibrary_WPF"
xmlns:posButton="clr-namespace:DLIUnitLibrary_WPF.Buttons"
xmlns:UnitImagePanels="clr-namespace:DLIUnitLibrary_WPF.UnitImagePanels"
Background="{DynamicResource formBackground}"
Width="800"
Height="480"
WindowState="Maximized"
WindowStyle="None"
Loaded="Window_Loaded">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Viewbox Margin="10">
<DockPanel x:Name="mainView"
Height="480"
Width="800">
<local:DLIHeader DockPanel.Dock="Top"
Visibility="Hidden" />
<WrapPanel Width="125"
ItemHeight="125"
ItemWidth="125"
Margin="0,5,0,0"
DockPanel.Dock="Right"
Orientation="Vertical"
VerticalAlignment="Bottom">
<posButton:OposButton x:Name="msrButton"
Margin="5"
ImageSource="Images/msr_keymon.png" />
<posButton:OposButton x:Name="imagerButton"
Margin="5"
ImageSource="Images/barcode_keymon.png" />
<posButton:OposButton x:Name="brightButton"
Margin="5"
ImageSource="Images/brightness_keymon.png" />
</WrapPanel>
<Grid Margin="10">
<Viewbox x:Name="tablet9viewbox"
Visibility="Hidden">
<UnitImagePanels:Tablet9Image />
</Viewbox>
<Viewbox x:Name="tablet7viewbox" Visibility="Hidden">
<UnitImagePanels:Tablet7Image>
<UnitImagePanels:Tablet7Image.LayoutTransform>
<TransformGroup>
<ScaleTransform />
<SkewTransform />
<RotateTransform Angle="90" />
<TranslateTransform />
</TransformGroup>
</UnitImagePanels:Tablet7Image.LayoutTransform>
</UnitImagePanels:Tablet7Image>
</Viewbox>
</Grid>
</DockPanel>
</Viewbox>
</Window>
tablet7 上的屏幕分辨率为 800x480。平板电脑有一个模拟的 800x600,当我达到它时,我可以看到所有 3 个按钮。
tablet9 上的屏幕分辨率为 1024x768,并且没有 2 按钮问题,事实上它可以完美呈现。我错过了什么?
编辑
我忘记了我的代码,对此感到抱歉。OnLoadedevent 并没有太多,但它就在这里
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.mainView.Height = System.Windows.SystemParameters.PrimaryScreenHeight;
this.mainView.Width = System.Windows.SystemParameters.PrimaryScreenWidth;
switch (DLIUnitFinder.GetDLIUnit())
{
case DLIUnit.tablet7:
this.tablet7viewbox.Visibility = System.Windows.Visibility.Visible;
break;
case DLIUnit.tablet9:
this.tablet9viewbox.Visibility = System.Windows.Visibility.Visible;
break;
}
}