共用方式為


LanguageService.GetImageList Method

Definition

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

public:
 virtual System::Windows::Forms::ImageList ^ GetImageList();
public virtual System.Windows.Forms.ImageList GetImageList ();
abstract member GetImageList : unit -> System.Windows.Forms.ImageList
override this.GetImageList : unit -> System.Windows.Forms.ImageList
Public Overridable Function GetImageList () As ImageList

Returns

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

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

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 Legacy Language Service Overview for a list of the icons in the default set and how icons are accessed in a language service.

Applies to