<p>Is there a way to draw a line along a curved path with a gradient that varies in a direction perpendicular to the direction of the line? I am using the GDI+ framework for my graphics.</p>

[{'answer_id': 63272, 'author': 'Phil Wright', 'author_id': 6276, 'author_profile': 'https://Stackoverflow.com/users/6276', 'pm_score': 1, 'selected': False, 'text': '<p>The simple answer is no. You can create a GraphicsPath in order to describe what you would like to draw, using AddPoint/AddLine/AddBezier and so forth as needed to describe the complex path of what you want to draw. When you draw the path you can provide a Brush which can be something like LinearGradientBrush or RadialGradientBrush. Neither of those gradient brushes reacts to the actual path being drawn in the sense of changing direction as the drawing occurs. You have to specify the angles etc as constant for the entire gradient area.</p>\n'}, {'answer_id': 780628, 'author': 'TK.', 'author_id': 1816, 'author_profile': 'https://Stackoverflow.com/users/1816', 'pm_score': 0, 'selected': False, 'text': '<p>One possible method you can use is to set the clip region of the Graphics object to be that of the line only. Then draw a Linear Gradient over the extremes of the line e.g.</p>\n\n<pre><code>GraphicsPath gp = new GraphicsPath();\n\ngp.AddArc(); // etc...\n\ngraphics.SetClip( gp );\n\ngraphics.FillRectangle( myLinearGradientBrush, gp.GetBounds());\n</code></pre>\n\n<p>The above code might give you what you are looking for. </p>\n'}]
['https://Stackoverflow.com/questions/62742', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7040/']