System.Drawing.Brush 来自 System.Drawing.Color
Posted
技术标签:
【中文标题】System.Drawing.Brush 来自 System.Drawing.Color【英文标题】:System.Drawing.Brush from System.Drawing.Color 【发布时间】:2011-08-09 17:41:39 【问题描述】:我正在为我们公司开发一个 WinForm 打印应用程序。
文档打印出来的时候,我需要把文档上每个Control的System.Drawing.Color
属性,创建一个System.Drawing.Brush
对象来绘制。
有没有办法将System.Drawing.Color
值转换为System.Drawing.Brush
值?
注意:我已尝试研究 System.Windows.Media.SolidColorBrush()
方法,但它似乎没有帮助。
【问题讨论】:
【参考方案1】:使用SolidBrush 类:
using (SolidBrush brush = new SolidBrush(yourColor))
// ...
【讨论】:
天哪!你知道我看过多少完全不相关的帖子让我大吃一惊吗?答案是如此接近,但我的情况从未在其中任何一个中得到真正解决。【参考方案2】:为什么不用 GDI+ 画笔?
http://msdn.microsoft.com/en-us/library/system.drawing.solidbrush.solidbrush.aspx
另一个用于 WPF。
【讨论】:
以上是关于System.Drawing.Brush 来自 System.Drawing.Color的主要内容,如果未能解决你的问题,请参考以下文章
在 s-s-rS Report Builder Execute(@Query) 中对列标题使用动态 SQL - 使用来自 1 个表的值作为来自不同表的值的列标题
使用来自两个实体的 NSFetchedResultsController(s)