开发者

A strange ghost line appearing in WPF near Label with WindowStyle="None"

Here is the code:

<Window x:Class="WpfWindow.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" Topmost="True" WindowStyle="None" ResizeMode="NoRes开发者_C百科ize"
             d:DesignHeight="300" d:DesignWidth="300" SizeToContent="WidthAndHeight" WindowStartupLocation="CenterScreen">

        <Label Content="Test label" />
</Window>

It produces the following image:

A strange ghost line appearing in WPF near Label with WindowStyle="None"

It seems to reproduce constantly with as long as the following parameters are set:

  • ResizeMode = "NoResize"
  • WindowStyle = "None"
  • SizeToContent = "WidthAndHeight"

I hoped it'd disappear if I set a border color for the window, however, it stays there even if I do that...

Anyone has an idea of how I can make this line disappear?

Thanks!


Add SnapsToDevicePixels="True" to the window properties.

What I think you are seeing here is a sliver of the black behind the window background. You can see this black in full if you set the Background color to Transparent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜