Search code examples
c#.netwinformscompact-framework

Why is this supposedly dashed line showing up as solid in the Windows Forms .NET Compact Framework?


The following code occurs inside the System.Windows.Forms.PaintEventHandler of a System.Windows.Forms.PictureBox under the .NET Compact Framework (e is of type 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);
}

The line is rendering solid in spite of the fact I've set the DashStyle to Dashed. The length and color are just fine.

Any ideas?


Solution

  • This is actually 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.