Esempio n. 1
0
        private static ImageList CreateImageList(StringCollection types)
        {
            ImageList images = new ImageList();

            Bitmap unknownBmp = new Bitmap(WixFiles.GetResourceStream("elements.unknown.bmp"));

            unknownBmp.MakeTransparent();

            Bitmap typeBmp;

            foreach (string type in types)
            {
                try
                {
                    typeBmp = null;

                    if (type.StartsWith("deprecated"))
                    {
                        if (WixFiles.HasResource(String.Format("elements.{0}.bmp", type.Remove(0, 11).ToLower())))
                        {
                            typeBmp = new Bitmap(WixFiles.GetResourceStream(String.Format("elements.{0}.bmp", type.Remove(0, 11).ToLower())));
                            Bitmap tmpBmp = OverlayWarning(typeBmp);
                            typeBmp.Dispose();
                            typeBmp = tmpBmp;
                        }
                    }
                    else
                    {
                        if (WixFiles.HasResource(String.Format("elements.{0}.bmp", type.ToLower())))
                        {
                            typeBmp = new Bitmap(WixFiles.GetResourceStream(String.Format("elements.{0}.bmp", type.ToLower())));
                        }
                    }
                    if (typeBmp != null)
                    {
                        typeBmp.MakeTransparent();
                    }
                    else
                    {
                        typeBmp = unknownBmp;
                    }
                }
                catch
                {
                    typeBmp = unknownBmp;
                }

                images.Images.Add(typeBmp);
            }

            Bitmap unsupportedBmp = new Bitmap(WixFiles.GetResourceStream("elements.unsupported.bmp"));

            unsupportedBmp.MakeTransparent();

            images.Images.Add(unsupportedBmp);

            return(images);
        }