System.Drawing.Brush from System.Drawing.Color
Solution 1
Use the SolidBrush class:
using (SolidBrush brush = new SolidBrush(yourColor)) {
// ...
}
Solution 2
Why not the GDI+ brush?
http://msdn.microsoft.com/en-us/library/system.drawing.solidbrush.solidbrush.aspx
The other one is for WPF.
jp2code
Software Developer @ IPKeys and jp2code.net Long ago, I left home and joined the United States Marine Corps where I was assigned the Military Occupational Specialty (MOS) of Basic Metal Worker (MOS 1316). I loved building things as a welder, but could not see myself doing this until I reached age 65. After my Honorable Discharge in the early 1990s, I used my G.I. Bill to go to school and received my Bachelor of Science Degree in Physics four years later. Using a love of computers since I played on a Commodore 64 at 10 years old and two (2) C++ electives that I had taken in school, I began working in the computer programming field. The recession following ENRON in 2001 left me working at a remedial job for a little over two years while I brushed up on my skills at a local community college in SQL and first learned what the new .NET Framework was all about. I have had the pleasure of working as a Software Developer since 2003. For a short while, I pulled in a little extra income by running a moonlighting business under the name Joe's Welding. Dangerous working conditions and non-paying customers prompted me to sell my mobile welding equipment about the time my son was born. Today, I am exclusively a Software Developer. My language of choice is C#, and I enjoy working with databases. If you care to find me anywhere else, just do a search on my screen name: jp2code
Updated on April 21, 2020Comments
-
jp2code about 4 years
I'm developing a WinForm Printing application for our company.
When the document is printed, I need to take the
System.Drawing.Color
property of each Control on the document and create aSystem.Drawing.Brush
object to draw it.Is there a way to convert the
System.Drawing.Color
value to aSystem.Drawing.Brush
value?NOTE: I've tried looking into the
System.Windows.Media.SolidColorBrush()
method, but it does not seem to be helpful.