Пример #1
0
        public void AddOverlayAndDrawTest()
        {
            var il = new ImageList()
            {
                ColorDepth = ColorDepth.Depth32Bit, ImageSize = new Size(32, 32)
            };

            il.Images.Add(new Icon(@"C:\Temp\help.ico"));
            Assert.That(il.Images.Count, Is.EqualTo(1));
            var ovIdx = il.AddOverlay(new Bitmap(@"C:\Temp\overlay32.png"), Color.Transparent);

            Assert.That(il.Images.Count, Is.EqualTo(2));
            var bmp = new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            using (var g = Graphics.FromImage(bmp))
                il.Draw(g, new Rectangle(0, 0, 32, 32), 0, Color.Transparent, COLORREF.None, overlayImageIndex: ovIdx);
            ShowImage(bmp);
        }
Пример #2
0
        public void AddOverlayAndDrawTest()
        {
            var il = new ImageList()
            {
                ColorDepth = ColorDepth.Depth32Bit, ImageSize = new Size(32, 32)
            };

            il.Images.Add(new Icon(Vanara.PInvoke.Tests.TestCaseSources.SmallFile));
            Assert.That(il.Images.Count, Is.EqualTo(1));
            var ovIdx = il.AddOverlay(new Bitmap(Vanara.PInvoke.Tests.TestCaseSources.Image2File), Color.Transparent);

            Assert.That(il.Images.Count, Is.EqualTo(2));
            var bmp = new Bitmap(32, 32, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            using (var g = Graphics.FromImage(bmp))
                il.Draw(g, new Rectangle(0, 0, 32, 32), 0, Color.Transparent, COLORREF.None, overlayImageIndex: ovIdx);
            ShowImage(bmp);
        }