The following example demonstrates the use of the System.Windows.Forms.Clipboard DotNetClass to read and write bitmaps from/to the Windows Clipboard.

The script can be saved into one of the Startup folders to be evaluated on startup.
The custom function will be executed by a PostRender callback each time the renderer finishes.

fn CopyRenderToClipboard = --define a global function
(
  clipboardClass = dotNetClass "System.Windows.Forms.Clipboard" --create a Clipboard dotNetClass
  b = getLastRenderedImage() --get the last saved image
  theFileName = GetDir #image + "\\_renderToClipboard.bmp" --define a temp.file name
  b.filename = theFileName --set the bitmap's file name
  save b --save the bitmap
  close b --close the bitmap
  theImage = dotNetClass "System.Drawing.Image" --create an Image dotNetClass
  theBitmap = theImage.FromFile theFileName --get the saved image from file as bitmap
  clipboardClass.setImage theBitmap --copy the image to clipboard
  theBitmap.Dispose() --release the bitmap
  deleteFile theFileName --delete the temp. file
  clipboardClass.ContainsImage() --return true if the clipboard contains image
)--end fn

callbacks.removeScripts id:#CopyRenderToClipboard --remove any callbacks with the given ID
callbacks.addScript #PostRender "CopyRenderToClipboard()" id:#CopyRenderToClipboard --register a callback to run the function post-render

相关文章:

  • 2021-10-13
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-11
  • 2022-02-07
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2021-06-02
  • 2021-06-30
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-01-17
相关资源
相似解决方案