How to display canvas thumbnails.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: How to display canvas thumbnails.

Hybrid View

  1. #1
    Join Date
    May 2009

    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

  2. #2
    Join Date
    Jan 2009

    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:

    <Image x:Name="image" />
    I have an image saved to disk that I load into memory by doing the following:

    FileInfo fileInf = new FileInfo("out.png");
    byte[] imageBytes = File.ReadAllBytes(fileInf.FullName);
    Then, when I want to display the image I do the following:
    using (MemoryStream ms = new MemoryStream(imageBytes))
        BitmapImage img = new BitmapImage();
        img.CacheOption = BitmapCacheOption.OnLoad;
        img.StreamSource = ms;
        this.image.Source = img;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center