[英]wp8 writeablebitmap doesn't render
我嘗試在可寫位圖上渲染一些元素。 它在渲染文本塊時起作用,而在其他情況下(例如矩形)則不起作用。 為什么這樣?
void bm_ImageOpened(object sender, RoutedEventArgs e)
{
WriteableBitmap wbm = new WriteableBitmap((BitmapImage)sender);
TextBlock tb = new TextBlock();
tb.FontSize = 40;
tb.Text = "text";
Rectangle rt = new Rectangle();
rt.Width = 50;
rt.Width = 30;
rt.Fill = new SolidColorBrush(Colors.Red);
TranslateTransform tf = new TranslateTransform();
tf.X = 100;
tf.Y = 100;
wbm.Render(tb, tf); //this works
wbm.Render(rt, tf); //this not
wbmi.Invalidate();
}
您嘗試渲染Height = 0的Rectangle
已定義兩次Width。
我想它應該像這樣:
rt.Width = 50;
rt.Height = 30;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.