Created
September 24, 2015 04:16
-
-
Save madskristensen/8877c2f4b20cc3e6ddab to your computer and use it in GitHub Desktop.
Uses the IVsImageService2 to convert a KnownMoniker to BitmapSource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static BitmapSource GetImage(ImageMoniker moniker, int size) | |
{ | |
ImageAttributes imageAttributes = new ImageAttributes(); | |
imageAttributes.Flags = (uint)_ImageAttributesFlags.IAF_RequiredFlags; | |
imageAttributes.ImageType = (uint)_UIImageType.IT_Bitmap; | |
imageAttributes.Format = (uint)_UIDataFormat.DF_WPF; | |
imageAttributes.LogicalHeight = size; | |
imageAttributes.LogicalWidth = size; | |
imageAttributes.StructSize = Marshal.SizeOf(typeof(ImageAttributes)); | |
var service = (IVsImageService2)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsImageService)); | |
IVsUIObject result = service.GetImage(moniker, imageAttributes); | |
object data; | |
result.get_Data(out data); | |
if (data == null) | |
return null; | |
return data as BitmapSource; | |
} |
i have facebook token
me facebook id sadiqulngn
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hii