Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using GraphicsPath to add a string, then the returned PathPoints i use for the PathGradientBrush to make the figure's backcolor gradient.

However most of the Fonts with clear-cut figures are not properly closed in GraphicsPath, while others those curved are properly joined.

I tried .CloseFigure, also manually tried to add a line from .PathPoints(0) to .PathPoints(PathPoints.Length-1), with no success. Has anybody experienced this behaviour?

VB
e.Graphics.Clear(Me.BackColor)

            'drawing the string
            Using gp As New GraphicsPath
                gp.FillMode = FillMode.Winding

                gp.AddString(result, ft.FontFamily, ft.Style, ft.Size, stringLocation, StringFormat.GenericTypographic)
                gp.CloseFigure()

                Dim gpB As New PathGradientBrush(gp.PathPoints, WrapMode.Clamp)
                With gpB

                    '.FocusScales = New PointF(0.2!, 0.2!)
                    Dim _surroundingColor As Color = DimColor(_color, 255)
                    .SurroundColors = New Color(4 - 1) {}.[Select](Function(item) _surroundingColor).ToArray() 'make an array (optional), with 4 duplicate items
                    .SetSigmaBellShape(0.1!)
                    Dim _centerColor As Color = DimColor(_color, 200)
                    .CenterColor = _centerColor
                End With

                e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality
                e.Graphics.SmoothingMode = SmoothingMode.HighQuality
                'draw pathgradientbrush into graphics buffer
                e.Graphics.FillPath(gpB, gp)
            End Using


What I have tried:

--------------------------------------------------------------
Posted
Updated 14-Apr-16 14:22pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900