Beispiel #1
0
        /// <summary>
        ///  Initializes the system image list.
        /// </summary>
        private void InitImageList()
        {
            // setup the image list to hold the folder icons
            OPMShellTreeViewImageList                  = new System.Windows.Forms.ImageList();
            OPMShellTreeViewImageList.ColorDepth       = System.Windows.Forms.ColorDepth.Depth32Bit;
            OPMShellTreeViewImageList.ImageSize        = new System.Drawing.Size(16, 16);
            OPMShellTreeViewImageList.TransparentColor = System.Drawing.Color.Gainsboro;

            // add the Desktop icon to the image list
            try
            {
                OPMShellTreeViewImageList.Images.Add(ImageProvider.GetDesktopIcon(false));
            }
            catch
            {
                // Create a blank icon if the desktop icon fails for some reason
                Bitmap bmp = new Bitmap(16, 16);
                Image  img = (Image)bmp;
                OPMShellTreeViewImageList.Images.Add((Image)img.Clone());
                bmp.Dispose();
            }
            this.ImageList = OPMShellTreeViewImageList;
        }