public Pen CreatePen(Color color, float width, PenDashStyle style) { EnsureObjectNotDisposed(); var pen = m_Handle.CreatePen(color, width, style); return(new Canvas.Pen(pen)); }
internal static System.Drawing.Drawing2D.DashStyle xlat(PenDashStyle style) { switch (style) { case PenDashStyle.Dot: return(System.Drawing.Drawing2D.DashStyle.Dot); case PenDashStyle.Dash: return(System.Drawing.Drawing2D.DashStyle.Dash); case PenDashStyle.DashDot: return(System.Drawing.Drawing2D.DashStyle.DashDot); case PenDashStyle.DashDotDot: return(System.Drawing.Drawing2D.DashStyle.DashDotDot); case PenDashStyle.Solid: return(System.Drawing.Drawing2D.DashStyle.Solid); default: return(System.Drawing.Drawing2D.DashStyle.Solid); } }
public Pen(Color color, PenDashStyle dashStyle) { int styleValue = 0; switch (dashStyle) { case PenDashStyle.Solid: styleValue |= GDIConstants.PS_SOLID; break; case PenDashStyle.Dot: styleValue |= GDIConstants.PS_DOT; break; case PenDashStyle.Dash: styleValue |= GDIConstants.PS_DASH; break; case PenDashStyle.DashDot: styleValue |= GDIConstants.PS_DASHDOT; break; case PenDashStyle.DashDotDot: styleValue |= GDIConstants.PS_DASHDOTDOT; break; } Handle = NativeMethods.CreatePen(styleValue, 1, Color.ToWin32Color(color)); }
internal NetPen(Color color, float width, PenDashStyle style) { m_Pen = new Pen(color, width); m_Pen.DashStyle = xlator.xlat(style); }
private void rotateToolTypes() { switch (lineType) { case PenDashStyle.Solid: lineType = PenDashStyle.Dotted; arrowTool.Content = "Arrow tool: Dotted"; lineTool.Content = "Line tool: Dotted"; break; case PenDashStyle.Dotted: lineType = PenDashStyle.Dash; arrowTool.Content = "Arrow tool: Dash"; lineTool.Content = "Line tool: Dash"; break; case PenDashStyle.Dash: lineType = PenDashStyle.Solid; arrowTool.Content = "Arrow tool: Solid"; lineTool.Content = "Line tool: Solid"; break; } }