/// <summary> /// Creates pen for border painting /// </summary> /// <returns></returns> public static Pen InitPenForPaint(Color foreColor, ControlStyle controlStyle, CtrlLineType lineType, int lineWidth) { Pen pen = new Pen(foreColor); // set properties of pen pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; // Paint from inside when pen width is greater than 1 if (controlStyle == ControlStyle.TwoD) { pen.Width = lineWidth; float[] dashPattern = ControlRenderer.GetDashPattern(lineType); if (dashPattern != null) { pen.DashPattern = dashPattern; } } return(pen); }
/// <summary> /// Paints the Line control /// TODO : Move this method to LineRenderer /// </summary> public static void PaintLineForeGround(Graphics g, Color fgColor, ControlStyle style, int lineWidth, CtrlLineType lineStyle, Point pt1, Point pt2) { #if !PocketPC SmoothingMode orgmode = g.SmoothingMode; g.SmoothingMode = SmoothingMode.AntiAlias; #endif Pen pen = new Pen(fgColor, lineWidth); // TODO : use new pen's cache here float[] dashPattern = ControlRenderer.GetDashPattern(lineStyle); if (dashPattern != null) { pen.DashPattern = dashPattern; } LineRenderer.Draw(g, pen, pt1, pt2, style); #if !PocketPC g.SmoothingMode = orgmode; #endif }