Freigeben über


LanguageService.GetImageList Method

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

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Declaration
Public Overridable Function GetImageList As ImageList
'Usage
Dim instance As LanguageService
Dim returnValue As ImageList

returnValue = instance.GetImageList()
public virtual ImageList GetImageList()
public:
virtual ImageList^ GetImageList()
abstract GetImageList : unit -> ImageList 
override GetImageList : unit -> ImageList 
public function GetImageList() : ImageList

Return Value

Type: System.Windows.Forms.ImageList
If successful, returns an ImageList object; otherwise, returns a null value.

Remarks

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.

Examples

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;
        }
    }
}

.NET Framework Security

See Also

Reference

LanguageService Class

LanguageService Members

Microsoft.VisualStudio.Package Namespace