开发者

System.Drawing.Brush from System.Drawing.Color

开发者 https://www.devze.com 2023-02-27 04:01 出处:网络
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 creat

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.


Use the SolidBrush class:

using (SolidBrush brush = new SolidBrush(yourColor)) {
    // ...
}


Why not the GDI+ brush?

http://msdn.microsoft.com/en-us/library/system.drawing.solidbrush.solidbrush.aspx

The other one is for WPF.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号