2012-02-07 108 views
1

我正嘗試使用編碼器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(); 
    } 

回答

2

。你還沒有用正確的簽名聲明它,它應該是void App_Activated(object sender, EventArgs e)

+0

它不起作用它的說法類型或namepsace EventArgs找不到 – Telenoobies 2012-02-11 20:58:30

+0

其在.NET中的核心類,使用它,你只需要: - 使用系統; – 2012-02-11 22:27:24

+0

或System.EventArgs – 2012-02-11 22:27:50

相關問題