How to display canvas thumbnails.
Hi,
I am working on a WPF application. In this we will change the position of the components on the canvas. Every time we change the positions of the components on the canvas, we have to display a thumbnails of the canvas.
I have a procedure to create the images of the canvas.
http://blogs.msdn.com/saveenr/archiv...ng-bitmap.aspx
Now I have to display the images of the thumbnail as canvas dynamically as thumbnails.
If anyone have any idea to solve this please reply me.
Thanks in Advance
Re: How to display canvas thumbnails.
I may not fully understand the question, but here is one method to display an image dynamically (in code):
I assume that you have an Image control defined somewhere where you want to display the thumbnail? In this example, I have this defined in XAML:
Code:
<Image x:Name="image" />
I have an image saved to disk that I load into memory by doing the following:
Code:
FileInfo fileInf = new FileInfo("out.png");
byte[] imageBytes = File.ReadAllBytes(fileInf.FullName);
Then, when I want to display the image I do the following:
Code:
using (MemoryStream ms = new MemoryStream(imageBytes))
{
BitmapImage img = new BitmapImage();
img.BeginInit();
img.CacheOption = BitmapCacheOption.OnLoad;
img.StreamSource = ms;
img.EndInit();
this.image.Source = img;
}