Skip to content

Instantly share code, notes, and snippets.

@CC58
Last active July 20, 2016 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CC58/2dd65fd935b63d14db311148506080e1 to your computer and use it in GitHub Desktop.
Save CC58/2dd65fd935b63d14db311148506080e1 to your computer and use it in GitHub Desktop.
## IronPython Script for SharpCap
## SCREEN CAPTURE of video to new window for 2nd monitor v1.1
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
from System.Drawing import Bitmap, Graphics, Point, Size
from System.Windows.Forms import (
Application, Button, Form, FormWindowState,
PictureBox, Screen
)
frm = Form(Text="Capture Screen")
frm.ClientSize = Size(720, 576)
pb = PictureBox()
pb.Location = Point(0,0)
pb.Size = Size(720, 576)
frm.Controls.Add(pb)
def cmdScreenUpdate ():
bmp = Bitmap(720, 576)
g = Graphics.FromImage(bmp)
## SharpCap.ReticuleForm
## SharpCap.TransparentMouseCaptureForm
g.CopyFromScreen(SharpCap.MainWindow.Location.X+10, SharpCap.MainWindow.Location.Y+80, 0, 0, bmp.Size)
g.Dispose()
pb.Image = bmp
pb.Size = bmp.Size
frm.Text=("Capture Screen - Object Name = <<< %s >>>" % SharpCap.TargetName) ## print object name to 2nd screen
def main():
SharpCap.AddCustomButton("<Snap>", None, None, cmdScreenUpdate)
Application.EnableVisualStyles()
Application.Run(frm)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment