コード例 #1
0
        public override Image GetImageForBaseConstruct(IBaseConstruct bc, Status status)
        {
            if (!(bc is ArchAngel.Providers.CodeProvider.DotNet.BaseConstruct))
            {
                throw new ArgumentException("Given BaseConstruct is not a CSharp construct");
            }

            CSharpConstructType consType = GetConsType(bc);

            if (combinedImages.ContainsKey(consType) == false)
            {
                // Construct the new image
                combinedImages[consType] = new Dictionary <Status, Image>();
                Bitmap image = CreateImage(consType, status);
                combinedImages[consType].Add(status, image);
                return(image);
            }
            else
            {
                Dictionary <Status, Image> dict = combinedImages[consType];

                if (dict.ContainsKey(status))
                {
                    return(dict[status]);
                }
                Bitmap image = CreateImage(consType, status);
                combinedImages[consType].Add(status, image);
                return(image);
            }
        }
コード例 #2
0
        private Bitmap CreateImage(CSharpConstructType consType, Status status)
        {
            Bitmap image = new Bitmap(32, 16);
            //Create a new Bitmap and Graphics object to write too.
            Graphics OutPutGraphics = Graphics.FromImage(image);

            OutPutGraphics.Clear(Color.Transparent);

            //Write the two new images at the x and y values
            Image fileTypeImage = cSharpImageList.Images[consType.ToString()];

            if (fileTypeImage == null)
            {
                throw new InvalidOperationException(
                          "Cannot find the file type image. The CSharpConstructType enum has been updated without updating the image list.");
            }

            Image statusImage = statusImageList.Images[status.ToString()];

            if (statusImage == null)
            {
                throw new InvalidOperationException(
                          "Cannot find the status image. The Status enum has been updated without updating the image list.");
            }

            ImageAttributes attr = new ImageAttributes();
//			attr.SetColorKey(Color.Magenta, Color.Magenta);

            Rectangle dstRect = new Rectangle(0, 0, 16, 16);

            OutPutGraphics.DrawImage(fileTypeImage, dstRect, 0, 0, fileTypeImage.Width, fileTypeImage.Height, GraphicsUnit.Pixel, attr);

            dstRect = new Rectangle(16, 0, 16, 16);
            OutPutGraphics.DrawImage(statusImage, dstRect, 0, 0, statusImage.Width, statusImage.Height, GraphicsUnit.Pixel, attr);
            return(image);
        }
コード例 #3
0
        private Bitmap CreateImage(CSharpConstructType consType, Status status)
        {
            Bitmap image = new Bitmap(32, 16);
            //Create a new Bitmap and Graphics object to write too.
            Graphics OutPutGraphics = Graphics.FromImage(image);
            OutPutGraphics.Clear(Color.Transparent);

            //Write the two new images at the x and y values
            Image fileTypeImage = cSharpImageList.Images[consType.ToString()];
            if (fileTypeImage == null)
                throw new InvalidOperationException(
                    "Cannot find the file type image. The CSharpConstructType enum has been updated without updating the image list.");

            Image statusImage = statusImageList.Images[status.ToString()];
            if (statusImage == null)
                throw new InvalidOperationException(
                    "Cannot find the status image. The Status enum has been updated without updating the image list.");

            ImageAttributes attr = new ImageAttributes();
            //			attr.SetColorKey(Color.Magenta, Color.Magenta);

            Rectangle dstRect = new Rectangle(0, 0, 16, 16);
            OutPutGraphics.DrawImage(fileTypeImage, dstRect, 0, 0, fileTypeImage.Width, fileTypeImage.Height, GraphicsUnit.Pixel, attr);

            dstRect = new Rectangle(16, 0, 16, 16);
            OutPutGraphics.DrawImage(statusImage, dstRect, 0, 0, statusImage.Width, statusImage.Height, GraphicsUnit.Pixel, attr);
            return image;
        }