2010-11-16 52 views

回答

4

創建一個BitmapFrame並使用它的解碼器。例如,要訪問48x48,32位圖像:

BitmapFrame icon = BitmapFrame.Create(new Uri("pack://application:,,,/Resources/Icon.ico", UriKind.Absolute)); 
BitmapFrame image = icon.Decoder.Frames.First(f => f.PixelHeight == 48 && f.Format.BitsPerPixel == 32); 
+0

感謝Meleak爲我提供簡潔解決方案的關鍵類。 – 2010-11-24 15:21:50