LanguageService::GetImageList Method ()

 

Returns an image list containing glyphs associated with the language service.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public:
virtual ImageList^ GetImageList()

Return Value

Type: System.Windows.Forms::ImageList^

If successful, returns an ImageList object; otherwise, returns a null value.

Glyphs are used as icons in the drop-down bars and in the IntelliSense completion lists.

The base method returns an image list obtained from the "Resources.completionset.bmp" image and assumes the transparent color is solid green (RGB(0x00,0xff,0x00)). Icons are assumed to be 16 x 16 pixels in size. See Language Service Overview (Managed Package Framework) for a list of the icons in the default set and how icons are accessed in a language service.

The following example shows how to provide an image list from a resource image called "resources.Images.bmp" with a magenta transparency.

using System.Windows.Forms;
using System.IO;
using System.Reflection;
using Microsoft.VisualStudio.Package;

namespace MyLanguagePackage
{
    [Guid("B614A40A-80D9-4fac-A6AD-FC2868FFF7CD")]
    public class MyLanguageService : LanguageService
    {
        public override ImageList GetImageList()
        {
            Color background = Color.Magenta;
            ImageList ilist = new ImageList();
            ilist.ImageSize = new Size(16, 16);
            ilist.TransparentColor = background;
            Assembly a = typeof(MyLanguageService).Assembly
            Stream stm = a.GetManifestResourceStream("Resources.Images.bmp");
            ilist.Images.AddStrip(new Bitmap(stm));
            return ilist;
        }
    }
}
Return to top
Show: