Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
how to make a gradient color out of 2 colors?

like in the picture below:-
http://www.vanseodesign.com/blog/wp-content/uploads/2012/11/linear-gradient.png[^]
Posted
Comments
Sergey Alexandrovich Kryukov 22-Feb-14 23:48pm    
What's wrong with just reading standard MSDN documentation?
For a person who somehow published 151 answers on this forum, this is unacceptable level of documentation search and reading skills. Why won't you work at it?
—SA
agent_kruger 22-Feb-14 23:52pm    
sir, a long time ago i found it but just now i don't know the exact name to searc for.
Sergey Alexandrovich Kryukov 22-Feb-14 23:55pm    
I just explained what to do: sharpen your skills. Anyway, I provided a complete answer for you, please use it.
—SA

1 solution

Easy. Use the class System.Drawing.Drawing2D.LinearGradientBrush:
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.lineargradientbrush%28v=vs.110%29.aspx[^].

Use this brush in the call to one of the methods System.Drawing.Graphics.FillRectangle:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fillrectangle%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

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