Bug
Bug

Reputation: 185

How to use an image like a sprite sheet with an image class?

My research on rendering 2d images led me to this... Spritesheet in Silverlight This Answer was good enough however, I do not want to use rectangle. I think using an image class to just show the image makes more sense.. After trying to understanding the above example. I came up with following code...

img = new Image();
img.Source = 500x500BigHugeImage;
img.Width = 100
img.Height = 100
img.Stretch = System.Windows.Media.Stretch.None;
img.VerticalAlignment = System.Windows.VerticalAlignment.Top;
img.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;

Now the image class only shows the top left corner of the source image. I need to navigate through the huge 500x500BigHugeImae in order to move to the I can't navigate.

Upvotes: 0

Views: 2001

Answers (1)

brunnerh
brunnerh

Reputation: 184524

I think using an image class to just show the image makes more sense.

You are not just "showing an image", you need a specific portion of it, in that case it does make more sense to use Rectangle in combination with an ImageBrush.

Upvotes: 1

Related Questions