System.Drawing.Brush从的System.Drawing.Color [英] System.Drawing.Brush from System.Drawing.Color

查看:280
本文介绍了System.Drawing.Brush从的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

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆