DrawingContext.DrawRectangle绘图的默认背景色问题

最近在项目中使用到DrawingContext.DrawRectangle画图

using system.windows.Media
using(DrawingContext drawContext=RenderOpen())
{

drawContext.DrawRectangle(Brushes.Transparent,Pen(Brushs.White,2),new Rect(0,0,20,20));

//得到的是一个黑色框,说明WIN10中默认背景色为黑色

//现在我想得到白色框 方法如下
drawContext.DrawRectangle(Brushes.White,Pen(Brushs.White,2),new Rect(0,0,20,20));
}

猜你喜欢

转载自blog.csdn.net/qq_28368039/article/details/105714133