System.Drawing.Drawing2D.CustomLineCap.Dispose()

Here are the examples of the csharp api class System.Drawing.Drawing2D.CustomLineCap.Dispose() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Example 7

1. Example

Project: Zero-K-Infrastructure
Source File: LinkDrawing.cs
public void Draw(Graphics g, Point location, Size mapSize)
        {
            var imageTip = Tip.Scale(mapSize).Translate(location).ToPoint();
            var imageEnd = End.Scale(mapSize).Translate(location).ToPoint();

            // shorten the arrow on one side so it doesn't overlap with the planet
            if (IsArrow && !IsColonyLink) {
                Shorten(imageEnd, ref imageTip);
            }

            using (var brush = new LinearGradientBrush(imageTip, imageEnd, TipColor, EndColor))
            //using (var brush = new SolidBrush(Color.Red))
            using (var pen = new Pen(brush, LineWidth*mapSize.Width)) {
                CustomLineCap cap;
                if (IsArrow) {
                    if (IsColonyLink) {
                        pen.CustomEndCap = PenCapProvider.GetInheritanceRepresentation();
                        g.DrawLines(pen, new[] { imageTip, imageEnd });
                    } else {
                        cap = new AdjustableArrowCap(10, 12);
                        pen.CustomStartCap = cap;
                        g.DrawLines(pen, new[] { imageTip, imageEnd });
                        cap.Dispose();
                    }
                } else {
                    g.DrawLines(pen, new[] { imageTip, imageEnd });
                }

            }
        }