wpf - Button Border clipped in WPF with 125% DPI Setting
问题描述
When I use 125% DPI setting in Windows, sometimes a button border is not rendered. It seems to depend on the size and position, maybe also the parent element of a button:
In my app, I can also see in the WPF designer that a parent border seems to be too small in size, though the button itself is larger. Maybe the measure process is somehow wrong:
I tried changing UseLayoutRounding for the whole window, also changing SnapsToDevicePixels does not help. DPI Awareness is set in the manifest.
Does anyone know how to fix this for the entire application?
Thats the code in a default Wpf Window Application (I can't reproduce the problem right now, but the problem persists in my application):
<Window x:Class="WpfApp3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="MainWindow"
SizeToContent="WidthAndHeight">
<StackPanel>
<GroupBox>
<GroupBox.Header>
<Button Width="20"
Height="22"
Content="X" />
</GroupBox.Header>
</GroupBox>
<Button Width="20"
Height="22"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Content="X" />
</StackPanel>
</Window>
解决方案
推荐阅读
- elasticsearch - 词开发者的弹性搜索发现发展
- maven - 在 jenkins 和 Maven compile 中构建构建时发现问题
- drake - DeclareVectorInputPort() 函数运行时出错
- sql - 如何从另一个数据库的另一个表中添加列
- python - 在 Python 中使用带有 fileopendialog 返回参数的 Tkinter 问题
- python - 使用 panda.read_csv 与 numpy.loadtext 时的输出差异
- regex - 正则表达式从其链接获取firebase的文件路径
- scala - 调用过程的 Slick Query 不会终止程序
- jdbc - 使用 Rest 读取 Confluent JDBC Kafka 源连接器的当前递增值?
- javascript - Javascript逻辑空赋值等价