问题描述
如何在调整窗口大小时避免行破折号调整?考虑下图: http://leprastuff.ru/data/img/20130315/b83eea4a7G3f07ca53a0e118ddbb9230. >
How can I avoid line dash resize during the window resize? Consider the following image:http://leprastuff.ru/data/img/20130315/b83eea4a7a3f07ca53a0e118ddbb9230.Gif
<Rectangle SnapsToDevicePixels="True"
Stroke="DarkGray"
StrokeDashArray="10 10"
StrokeThickness="1" />
谢谢,托尼.
推荐答案
将矩形的Height
设置为大于1的值.
Set the Height
of the Rectangle to something greater than one.
当前,您正在上下绘制上下边框.从虚线的笔划从左上角开始沿顺时针方向绘制矩形的边框时,您将观察到行为.
Currently you're drawing the upper and lower border on top of each other. As the dashed stroke draws the Rectangle's border clockwise, starting at the top-left corner, you get the observed behaviour.
如果打算绘制一个高度为1的矩形,则最好绘制一个行.
If you intended to draw a Rectangle with a height of one, you might better draw a Line instead.
这篇关于WPF虚线—在调整大小时修复破折号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!