我有下一个代码:
var bmp = new WriteableBitmap((int)size.Width, (int)size.Height);
bmp.Render(new Canvas(){Background = new SolidColorBrush(Colors.White)}, null);
bmp.Invalidate();
return bmp;
我如何获得颜色:
var backColor = Application.Current.Resources["PhoneBackgroundColor"].ToString();
var foreColor = Application.Current.Resources["PhoneForegroundColor"].ToString();
我需要用白色背景渲染图像。但是这段代码总是用黑背渲染图像。前台没问题,我用下一个结构测试过:
Canvas
Textblock - with black foreground
Textblock - with black foreground
那么问题出在哪里?