System.Drawing.Brush从的System.Drawing.Color [英] System.Drawing.Brush from System.Drawing.Color
问题描述
我正在开发对我们公司一个WinForm打印应用程序。
I'm developing a WinForm Printing application for our company.
在打印文档时,我需要采取 System.Drawing中在文档的每个控制。颜色
属性,并创建一个 System.Drawing.Brush
对象来绘制它。
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.
有没有办法在的System.Drawing.Color
值转换为 System.Drawing.Brush $ C ?$ C>值
Is there a way to convert the System.Drawing.Color
value to a System.Drawing.Brush
value?
请注意:我试着寻找到 System.Windows.Media.SolidColorBrush()
方法,但它似乎并没有对大家有所帮助。
NOTE: I've tried looking into the System.Windows.Media.SolidColorBrush()
method, but it does not seem to be helpful.
推荐答案
使用的SolidBrush 类:
using (SolidBrush brush = new SolidBrush(yourColor)) {
// ...
}
这篇关于System.Drawing.Brush从的System.Drawing.Color的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!