从剪贴板返回剪贴板作为PNG的位图? [英] Bitmap from Clipboard back to Clipboard as PNG?

查看:118
本文介绍了从剪贴板返回剪贴板作为PNG的位图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好 -


我有以下代码从剪贴板获取位图并将

保存到* .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

解决方案

6月5日下午4:00 *,Joe Duchtel< duch ... @ gmail.comwrote:


您好 -


我有以下代码从剪贴板获取位图并将

保存为* .png文件...


* * * * Dim lData As 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


你好 -


我有.NET 1.1和Visual Studio 2003,没有GetImage和

剪贴板的SetImage功能。


谢谢,

Joe


6月5日,9:24 * am,kimiraikkonen< kimiraikkone ... @ gmail.comwrote:


6月5日下午4:00 *,Joe Duchtel< duch ... @ gmail.comwrote:



你好 -


我有以下代码从剪贴板获取位图,并将

保存到* .png文件...


* * * * Dim lData As IDataObject = Clipboard.GetDataObject()


* * * * if 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



检索图像从剪贴板,您考虑使用:


''假设您的图片框的名称是lPictureBox

lPictureBox.Image = Clipboard.GetImage


''现在以PNG格式保存

lPictureBox.Image.Save(" Test.png",

System.Drawing .Imaging.ImageFormat.Png)


....和


''将图像添加到剪贴板

Clipboard.SetImage(lPictureBox.Image)


谢谢,


OnurGüzel-隐藏引用文字 -


- 显示引用的文字 -


6月5日下午5:18,Joe Duchtel< duch ... @ gmail.comwrote:


你好 -


我有.NET 1.1和Visual Studio 2003,没有GetImage和

剪贴板的SetImage函数br />

谢谢,

Joe


6月5日上午9:24,kimiraikkonen< kimiraikkone ... @ gmail.comwrote:


6月5日下午4:00,Joe Duchtel< duch ... @ gmail.comwrote:


Hello -


我有以下代码从剪贴板获取位图并将

保存到* .png文件...


Dim lData As 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重新放回剪贴板?

我找到了剪贴板.SetDataObject()函数但是如何使用

PictureBox或Image将其转换为可以由

SetDataObject()使用的格式?


谢谢!

Joe


要从剪贴板中检索图像,您是否考虑使用:


''假设你的图片框名称是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

解决方案

On Jun 5, 4:00*pm, Joe Duchtel <duch...@gmail.comwrote:

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


Hello -

I have .NET 1.1 and Visual Studio 2003 and there is no GetImage and
SetImage function of Clipboard.

Thanks,
Joe

On Jun 5, 9:24*am, kimiraikkonen <kimiraikkone...@gmail.comwrote:

On Jun 5, 4:00*pm, Joe Duchtel <duch...@gmail.comwrote:


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- Hide quoted text -

- Show quoted text -


On Jun 5, 5:18 pm, Joe Duchtel <duch...@gmail.comwrote:

Hello -

I have .NET 1.1 and Visual Studio 2003 and there is no GetImage and
SetImage function of Clipboard.

Thanks,
Joe

On Jun 5, 9:24 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:

On Jun 5, 4:00 pm, Joe Duchtel <duch...@gmail.comwrote:

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- 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的位图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆