Skip to content

Instantly share code, notes, and snippets.

@CC58
Last active Jul 20, 2016
Embed
What would you like to do?
## 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