为什么这条虚线在 Windows Forms .NET Compact Framework 中显示为实线?
Why is this supposedly dashed line showing up as solid in the Windows Forms .NET Compact Framework?
以下代码出现在 .NET Compact Framework 下的 System.Windows.Forms.PictureBox 的 System.Windows.Forms.PaintEventHandler 中(e 的类型为 PaintEventArgs):
var penDashed = new Pen(Color.Red, 3);
penDashed.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
using (penDashed)
{
e.Graphics.DrawLine(penDashed, 30, 30, 100, 30);
}
尽管我已将 DashStyle 设置为 Dashed,但线条呈现为实线。长度和颜色都刚刚好
有什么想法吗?
这实际上是documented (for the Windows API, not specifically for the compact framework) here:
Windows CE supports wide pens and dashed pens, but does not support dotted pens, inside frame pens, geometric pens, pen endcap styles, or pens that are both wide and dashed.
以下代码出现在 .NET Compact Framework 下的 System.Windows.Forms.PictureBox 的 System.Windows.Forms.PaintEventHandler 中(e 的类型为 PaintEventArgs):
var penDashed = new Pen(Color.Red, 3);
penDashed.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
using (penDashed)
{
e.Graphics.DrawLine(penDashed, 30, 30, 100, 30);
}
尽管我已将 DashStyle 设置为 Dashed,但线条呈现为实线。长度和颜色都刚刚好
有什么想法吗?
这实际上是documented (for the Windows API, not specifically for the compact framework) here:
Windows CE supports wide pens and dashed pens, but does not support dotted pens, inside frame pens, geometric pens, pen endcap styles, or pens that are both wide and dashed.