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
  • 相关阅读:
    【bzoj1196】[HNOI2006]公路修建问题
    【bzoj1082】栅栏[SCOI2005]
    【bzoj1012】[JSOI2008]最大数maxnumber
    【bzoj2330】 [SCOI2011]糖果
    【bzoj1008】[HNOI2008]越狱
    【bzoj1002】 [FJOI2007]轮状病毒DP
    【bzoj1001】[BeiJing2006]狼抓兔子
    C++-POJ2234-Matches Game[Nim][SG函数]
    C++-POJ1067-取石子游戏
    lodash常用
  • 原文地址:https://www.cnblogs.com/softimagewht/p/bobo.html
Copyright © 2011-2022 走看看