I want to create a large photo thread for my user interface, and I tried to do it as follows:
RenderTargetBitmap renderer = new RenderTargetBitmap(WIDTH, HEIGHT, dpiX, dpiY, PixelFormats.Pbgra32);
renderer.Render(vbox);
renderer.Freeze();
"vbox" is my UIElement, it is created in the background thread, and I need to display it in a bitmap to show it in the main user interface thread. I will not use "vbox" anywhere after I have finished rendering it to a bitmap.
These codes worked, but then I found that I was not satisfied with it because it looked bad if I enlarge the size of the thumb image.
I hope I can use something like vector graphics, so I tried to do it like this:
var visualBrush = new VisualBrush(vbox);
visualBrush.Stretch = Stretch.Uniform;
visualBrush.Freeze();
Of course, this did not work, because I could not freeze the visual brush with it. The Visual property was set to any value other than Null.
Can anyone help me out? Thank you very much.
amuses
Alex
source
share