我正在尝试使用以下代码但在调度程序中调整画布的大小。它似乎不起作用我错过了什么吗?
Dispatcher.BeginInvoke(new Action(() => {
canvas.RenderTransform = new ScaleTransform(scale,
scale);
canvas.Measure(new Size(scale * w, scale * h));
canvas.Arrange(new Rect(0, 0, scale * w, scale *
h));
canvas.UpdateLayout();
RenderTargetBitmap rtb = new RenderTargetBitmap(scale * w, scale * h, 96, 96, PixelFormats.Pbgra32);
rtb.Render(canvas);
}), DispatcherPriority.Send);
}