Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Cropping images in WPF

$
0
0
Hi,

I have 2 images. The first are 5 golden stars, the 2nd are 5 silver stars. I want to make a rating usercontrol where I have to add a score and the usercontrol does the rest. The 2nd part I can do on my own, it just the first part with the images.
    <Grid>
        <Viewbox HorizontalAlignment="Left">
            <Image Stretch="None">
                <Image.Source>
                    <CroppedBitmap Source="/Movie List WPF;component/Resources/5StarSilver.png" 
                                   SourceRect="30 0 75 50"/>
                </Image.Source>
            </Image>
        </Viewbox>
    </Grid>
So, I'm not getting any image in my Viewbox. If I do it with only an Image and same source it works fine but I'm not able to crop it then. Am I doing something wrong in my code with the CroppedBitmap? I'm really clueless on this one.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>