问题描述
您好 -
我有以下代码从剪贴板获取位图并将
保存到* .png文件中...
Dim lData作为IDataObject = Clipboard.GetDataObject()
如果lData.GetDataPresent(DataFormats.Bitmap)那么
Dim lPictureBox As New PictureBox
lPictureBox.Image = lData.GetData(DataFormats.Bitmap,
True)
lPictureBox .Image.Save(" Test.png",
System.Drawing.Imaging.ImageFormat.Png)
结束如果
我如何拍摄图像并将其作为Png重新放回剪贴板?
我找到了Clipboard.SetDataObject()函数但是如何使用
PictureBox或Image将其转换为可以由
SetDataObject()使用的格式?
谢谢!
Joe
To从剪贴板中检索图像,请你考虑一下使用:
''假设你的图片盒的名字是lPictureBox
lPictureBox.Image = Clipboard.GetImage
''现在以PNG格式保存
lPictureBox.Image.Save(" Test.png",
System.Drawing.Imaging.ImageFormat。 Png)
....和
''将图像添加到剪贴板
Clipboard.SetImage( lPictureBox.Image)
谢谢,
OnurGüzel
检索图像从剪贴板,您考虑使用:
''假设您的图片框的名称是lPictureBox
lPictureBox.Image = Clipboard.GetImage
''现在以PNG格式保存
lPictureBox.Image.Save(" Test.png",
System.Drawing .Imaging.ImageFormat.Png)
....和
''将图像添加到剪贴板
Clipboard.SetImage(lPictureBox.Image)
谢谢,
OnurGüzel-隐藏引用文字 -
- 显示引用的文字 -
对不起,有.NET 2.0。我不知道他们是否不在场。
VS 2003 / .NET 1.1
因此请尝试将图像复制到剪贴板说SetDataObject在.NET 1.1中存在
:
Dim myimage As Object = lPictureBox.Image
Clipboard.SetDataObject(myimage)
谢谢,
OnurGüzel
Hello -
I have the following code to get a bitmap from the clipboard and to
save it to a *.png file ...
Dim lData As IDataObject = Clipboard.GetDataObject()
If lData.GetDataPresent(DataFormats.Bitmap) Then
Dim lPictureBox As New PictureBox
lPictureBox.Image = lData.GetData(DataFormats.Bitmap,
True)
lPictureBox.Image.Save("Test.png",
System.Drawing.Imaging.ImageFormat.Png)
End If
How can I take the Image and put it back onto the Clipboard as a Png?
I found the Clipboard.SetDataObject() function but how can I use the
PictureBox or Image to convert it into a format that can be used by
SetDataObject()?
Thanks!
Joe
To retrieve image from clipboard, have you considered using:
'' Assuming your picturebox''s name is "lPictureBox"
lPictureBox.Image = Clipboard.GetImage
'' Save now in PNG format
lPictureBox.Image.Save("Test.png",
System.Drawing.Imaging.ImageFormat.Png)
.... and
'' To add image to clipboard
Clipboard.SetImage(lPictureBox.Image)
Thanks,
Onur Güzel
To retrieve image from clipboard, have you considered using:
'' Assuming your picturebox''s name is "lPictureBox"
lPictureBox.Image = Clipboard.GetImage
'' Save now in PNG format
lPictureBox.Image.Save("Test.png",
System.Drawing.Imaging.ImageFormat.Png)
.... and
'' To add image to clipboard
Clipboard.SetImage(lPictureBox.Image)
Thanks,
Onur Güzel- Hide quoted text -
- Show quoted text -
Sorry, there are in .NET 2.0. I don''t know if they''re not present in
VS 2003 / .NET 1.1
So try this to copy image to clipboard as you say SetDataObject exists
in .NET 1.1:
Dim myimage As Object = lPictureBox.Image
Clipboard.SetDataObject(myimage)
Thanks,
Onur Güzel
这篇关于从剪贴板返回剪贴板作为PNG的位图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!