programming-examples/c-sharp/Others/Copying from the Clipboard.cs
2019-11-15 12:59:38 +01:00

26 lines
599 B
C#

Copying from the Clipboard
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;
public class MainClass {
public static void Main(string[] args) {
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text)) {
Console.WriteLine((String)iData.GetData(DataFormats.Text));
}
if (iData.GetDataPresent(DataFormats.Bitmap)) {
Image img = (Bitmap)iData.GetData(DataFormats.Bitmap);
}
}
}