예제 #1
0
        private static void Main(string[] args)
        {
            try
            {
                System.Windows.Forms.IDataObject content = Clipboard.GetDataObject();
                string[] formats = content.GetFormats();
                foreach (var f in formats)
                {
                    Console.WriteLine($"{f}");
                }

                if (Clipboard.ContainsImage())
                {
                    var    clipboardImage = Clipboard.GetImage();
                    string imagePath      = @"r:\temp\images\png\p1.png";
                    clipboardImage.Save(imagePath);
                }
            }
            catch (Exception ex)
            {
                var fullname = System.Reflection.Assembly.GetEntryAssembly().Location;
                var progname = Path.GetFileNameWithoutExtension(fullname);
                Console.Error.WriteLine($"{progname} Error: {ex.Message}");
            }
        }
예제 #2
0
 /// <summary>
 /// Returns a list of all formats that data stored in this instance is associated with or can be converted to.
 /// </summary>
 /// <returns>
 /// An array of the names that represents a list of all formats that are supported by the data stored in this object.
 /// </returns>
 public string[] GetFormats()
 {
     return(_underlyingDataObject.GetFormats());
 }