[英]C# how to convert system.windows.media.brush to system.drawing.brush
I am trying to add a watermark for a TextBox. 我正在尝试为TextBox添加水印。 The TextBox.Background is a System.Windows.Media.Brush.
TextBox.Background是一个System.Windows.Media.Brush。 I need the Graphics.FillRectangle(System.Drawing.Brush....)
我需要Graphics.FillRectangle(System.Drawing.Brush ....)
Is there any way to convert the mediea brush to the drawing brush? 有没有办法将mediea画笔转换为绘图画笔?
试试这个
System.Drawing.Brush b = new System.Drawing.SolidBrush((System.Drawing.Color)new System.Drawing.ColorConverter().ConvertFromString(new System.Windows.Media.BrushConverter().ConvertToString(mediabrush)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.