C#如何将system.windows.media.brush转换为system.drawing.brush

时间:2013-10-24 15:46:46

标签: c# system.drawing

我正在尝试为TextBox添加水印。 TextBox.Background是一个System.Windows.Media.Brush。我需要Graphics.FillRectangle(System.Drawing.Brush ....)

有没有办法将mediea画笔转换为绘图画笔?

1 个答案:

答案 0 :(得分:6)

试试这个

System.Drawing.Brush b = new System.Drawing.SolidBrush((System.Drawing.Color)new System.Drawing.ColorConverter().ConvertFromString(new System.Windows.Media.BrushConverter().ConvertToString(mediabrush)));
相关问题