Skip to content

Instantly share code, notes, and snippets.

@madskristensen
Created September 24, 2015 04:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save madskristensen/8877c2f4b20cc3e6ddab to your computer and use it in GitHub Desktop.
Save madskristensen/8877c2f4b20cc3e6ddab to your computer and use it in GitHub Desktop.
Uses the IVsImageService2 to convert a KnownMoniker to BitmapSource
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;
}
@sadiqulngn
Copy link

hii

@sadiqulngn
Copy link

i have facebook token

@sadiqulngn
Copy link

me facebook id sadiqulngn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment