请问如何将剪贴板中的数据(图象)保存到字节数组中去?
private void button2_Click(object sender, System.EventArgs e)
{
IDataObject d = Clipboard.GetDataObject();
if(d.GetDataPresent(DataFormats.Bitmap))
{
Bitmap b = (Bitmap)d.GetData(DataFormats.Bitmap);
Byte[] byteBLOBData = new Byte[0];
byteBLOBData = (Byte[])b; // 这里会出错,无法完成转换
MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
pictureBox1.Image= Image.FromStream(stmBLOBData);
}
else
{
MessageBox.Show("No bitmap information was contained in the clipboard.");
}
}
多谢各位解答!!