Using Shellfile to get BitmapSource changes windows size

246 views Asked by At

I have this line of code screwing everything up.

private void button1_Click(object sender, EventArgs e)        
{        
    BitmapSource bitmapSource =
        ShellFile.FromFilePath(@"myfilepath").Thumbnail.ExtraLargeBitmapSource;  
}

So after this line of code runs, the whole window gets re-sized, which looks like something to do with the resolution and DPI stuff. How can i fix this?

Screenshots:

I'm doing this because I want to get transparent thumbnails for any file, and for some reason when i just get the bitmap, transparent is black. so i had to get the source and convert it to bitmap, but this happens without the other code whatsoever.

I know i can set transparent color, but that is not a perfect solution and some images looks weird after, so i'm not going to do that.

0

There are 0 answers