Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Drawing.Brush from System.Drawing.Color

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 a System.Drawing.Brush object to draw it.

Is there a way to convert the System.Drawing.Color value to a System.Drawing.Brush value?

NOTE: I've tried looking into the System.Windows.Media.SolidColorBrush() method, but it does not seem to be helpful.

like image 921
jp2code Avatar asked Apr 20 '11 18:04

jp2code


1 Answers

Use the SolidBrush class:

using (SolidBrush brush = new SolidBrush(yourColor)) {     // ... } 
like image 189
Frédéric Hamidi Avatar answered Sep 23 '22 09:09

Frédéric Hamidi