Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting a graphic onto the clipboard (again)

Status
Not open for further replies.

RonPro

Programmer
Apr 10, 2002
74
US
I asked this before, but I think more clarity is required...

I have a custom graphic that the user is creating within a picture box as a function of my program. (I have also tried the image control)

I need to put that graphic onto the clipboard for use in other programs (more than likely WORD).

Using the Clear and SetData methods for the clipboard *DON'T* support that operation. Those are only for LOADED true image files (.Picture property). This is also noted on another web site, but the link to that person's solution is corrupt.

I don't know if this is a bug, or just the way it works because the Docs and third-party manuals don't address this requirement with a pragmatic solution - only a cursory re-hash of the MS doc text.

Has anyone got a solution for this???

Thanks.
Ron
 

One possible solution is to have your program create a temp file that you can use for the setdata method and delete the temp file on exit.

Good Luck

 
Compare and contrast the following:

Option Explicit

Private Sub Command1_Click()
Picture1.ScaleHeight = 100
Picture1.ScaleWidth = 100

' Your drawing stuff
Picture1.Cls
Picture1.Line (0, 0)-(100, 100)

Clipboard.Clear
Clipboard.SetData Picture1.Picture
End Sub

Private Sub Command2_Click()
Picture1.ScaleHeight = 100
Picture1.ScaleWidth = 100
Picture1.AutoRedraw = True

' Your drawing stuff
Picture1.Cls
Picture1.Line (0, 0)-(100, 100)

Picture1.AutoRedraw = False
Clipboard.Clear
Clipboard.SetData Picture1.Image
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top