ICSharpCode.TextEditor.BrushRegistry.GetDotPen C# (CSharp) Method

GetDotPen() public static method

public static GetDotPen ( Color color ) : Pen
color Color
return System.Drawing.Pen
		public static Pen GetDotPen(Color color)
		{
			lock (dotPens) {
				Pen pen;
				if (!dotPens.TryGetValue(color, out pen)) {
					pen = new Pen(color);
					pen.DashPattern = dotPattern;
					dotPens.Add(color, pen);
				}
				return pen;
			}
		}
	}

Usage Example

        public override void Paint(Graphics g, Rectangle rect)
        {
            if (rect.Width <= 0 || rect.Height <= 0)
            {
                return;
            }
            HighlightColor colorFor = this.textArea.Document.HighlightingStrategy.GetColorFor("LineNumbers");

            for (int i = 0; i < (base.DrawingPosition.Height + this.textArea.TextView.VisibleLineDrawingRemainder) / this.textArea.TextView.FontHeight + 1; i++)
            {
                int       x = base.DrawingPosition.X;
                Rectangle drawingPosition = base.DrawingPosition;
                int       top             = drawingPosition.Top + i * this.textArea.TextView.FontHeight - this.textArea.TextView.VisibleLineDrawingRemainder;
                Rectangle rectangle       = base.DrawingPosition;
                Rectangle rectangle1      = new Rectangle(x, top, rectangle.Width, this.textArea.TextView.FontHeight);
                if (rect.IntersectsWith(rectangle1))
                {
                    if (!this.textArea.Document.TextEditorProperties.ShowLineNumbers)
                    {
                        g.FillRectangle(BrushRegistry.GetBrush((this.textArea.Enabled ? colorFor.BackgroundColor : SystemColors.InactiveBorder)), rectangle1);
                    }
                    else
                    {
                        g.FillRectangle(BrushRegistry.GetBrush((this.textArea.Enabled ? colorFor.BackgroundColor : SystemColors.InactiveBorder)), rectangle1);
                        g.DrawLine(BrushRegistry.GetDotPen(colorFor.Color), this.drawingPosition.X, rectangle1.Y, this.drawingPosition.X, rectangle1.Bottom);
                    }
                    int firstLogicalLine = this.textArea.Document.GetFirstLogicalLine(this.textArea.TextView.FirstPhysicalLine + i);
                    if (firstLogicalLine < this.textArea.Document.TotalNumberOfLines)
                    {
                        this.PaintFoldMarker(g, firstLogicalLine, rectangle1);
                    }
                }
            }
        }
All Usage Examples Of ICSharpCode.TextEditor.BrushRegistry::GetDotPen