2011-01-13 143 views
6

在我的窗口中,黑線是小黑線。 爲什麼?C#WPF - 黑線在窗口中

Screenshot

<Window x:Class="WpfPortOfTestingCamera.InputSelection" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="InputSelection" WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" SizeToContent="WidthAndHeight" d:DesignWidth="280" d:DesignHeight="206"> 

     <StackPanel HorizontalAlignment="Center" Name="stackPanel1" VerticalAlignment="Top" Margin="10" MaxWidth="500"> 
      <GroupBox Header="Select Camera" HorizontalAlignment="Center" VerticalAlignment="Center"> 
       <ComboBox Height="23" Name="comboBox1" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="120" /> 
      </GroupBox> 
      <Button Content="OK" Name="ButtonOK" IsDefault="True" Click="ButtonOK_Click" /> 
     </StackPanel> 
</Window> 

回答

9

這似乎是時候當內容字符串設置窗口大小調整爲您的組合框的寬度時發生的渲染神器。

如果將屬性SnapsToDevicePixels =「True」添加到Window標籤,則黑線消失。

+0

使用SnapsToDevicePixels =「True」有什麼不利嗎? – Hooch 2011-01-14 06:19:20