示例#1
0
        public void ImageTransparencyTest()
        {
            // Before running copy an image from SnagIt's editor with transparency
            var data    = System.Windows.Clipboard.GetDataObject();
            var formats = data.GetFormats();

            //foreach (var f in formats)
            //    Console.WriteLine(" - " + f.ToString());

            string file = @"c:\temp\test.png";

            //var imgSource = System.Windows.Clipboard.GetImage();  // this won't display in a WPF Image control from SnagIt
            //using (var img = WindowUtilities.BitmapSourceToBitmap(imgSource))
            //{
            using (var img = ClipboardHelper.GetImage())
            {
                Assert.IsNotNull(img, "Image is null - no image data on the clipboard?");

                File.Delete(file);
                img.Save(file, ImageFormat.Png);
            }

            ShellUtils.ShellExecute(file);
        }