June 9th, 2009, 02:48 AM
How to display canvas thumbnails.
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.
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
July 1st, 2009, 03:04 PM
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:
I have an image saved to disk that I load into memory by doing the following:
<Image x:Name="image" />
Then, when I want to display the image I do the following:
FileInfo fileInf = new FileInfo("out.png");
byte imageBytes = File.ReadAllBytes(fileInf.FullName);
using (MemoryStream ms = new MemoryStream(imageBytes))
BitmapImage img = new BitmapImage();
img.CacheOption = BitmapCacheOption.OnLoad;
img.StreamSource = ms;
this.image.Source = img;
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.