如何在我的应用程序打开后立即开始屏幕录制?

时间:2012-02-07 03:27:11

标签: c# wpf

我正在尝试使用编码器4创建屏幕录制程序。 我希望我的程序在打开窗口后立即开始录制。以下是我到目前为止的情况:

但我不断收到错误消息:“App_Activated”没有重载匹配委托'System.EventHandler“

感谢您的帮助。

<Window x:Class="ScreenCapture.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Screen Capture" 
    Activated="App_Activated"
    Closing="OnClose"
    mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    Height="76" Width="99" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"                             WindowStyle="ToolWindow">


protected void App_Activated(object sender, System.ComponentModel.AddingNewEventArgs e)
    {
        System.Drawing.Size monitorSize = SystemInformation.PrimaryMonitorSize;
        Rectangle capRect = new Rectangle(0, 0, monitorSize.Width, monitorSize.Height);
        job.CaptureRectangle = capRect;
        job.OutputPath = @"C:\output\ScreenCap";
        job.Start();
    }

1 个答案:

答案 0 :(得分:2)

您尚未使用正确的签名声明它,它应该是void App_Activated(object sender, EventArgs e)