zoukankan      html  css  js  c++  java
  • Copying The Last Rendered Image To The Windows Clipboard

    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
  • 相关阅读:
    爬虫示例
    S20_DAY23--课堂笔记
    python--常用模块之正则
    S20_DAY22--课堂笔记
    win10系统重装
    CCF 命令行选项
    CCF 任务调度
    CCF 出现次数最多的数
    CCF ISBN
    CCF 最大的矩形
  • 原文地址:https://www.cnblogs.com/softimagewht/p/bobo.html
Copyright © 2011-2022 走看看