can't clear clipboard

Z

zbcong

hello
in my program,i have following method,it copy a jpg file to clipboard,and
works well:

Private Sub CopyImage()
Dim file As System.IO.Stream =
Me.GetType().Assembly.GetManifestResourceStream("ProductCatalog.Nwind.jpg")
Clipboard.SetDataObject(System.Drawing.Image.FromStream(file),
false)
End Sub
but after i exit the program,i open a word document,and from the menu select
"paste" command,the jpg picture still can be pasted,that means the clipboard
isn't cleared,if i modify the second line of the method as:

Clipboard.SetDataObject(System.Drawing.Image.FromStream(file), true)

the clipboard still can't be cleared,why?is it a bug?

thank you.
 
M

MsJuLiE

zbcong said:
hello
in my program,i have following method,it copy a jpg file to clipboard,and
works well:

Private Sub CopyImage()
Dim file As System.IO.Stream =
Me.GetType().Assembly.GetManifestResourceStream("ProductCatalog.Nwind.jpg")
Clipboard.SetDataObject(System.Drawing.Image.FromStream(file),
false)
End Sub
but after i exit the program,i open a word document,and from the menu select
"paste" command,the jpg picture still can be pasted,that means the clipboard
isn't cleared,if i modify the second line of the method as:

Clipboard.SetDataObject(System.Drawing.Image.FromStream(file), true)

the clipboard still can't be cleared,why?is it a bug?

thank you.

Why did you post this to a C# group?
 
?

=?ISO-8859-2?Q?Marcin_Grz=EAbski?=

Hi,

Did you try to set one image on:
Clipboard.SetDataObject(System.Drawing.Image.FromStream(file1)
, false)
and other on:
Clipboard.SetDataObject(System.Drawing.Image.FromStream(file2)
, true)
and then close the application?


I think that your problem starts with first copy of that
image (with copy parameter==true), and that image still remains
in Clipboard.
If i'm wrong then it looks like bug in .NET.

Regards
Marcin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top