我从 bitmapmixer 示例 (DirectShow.NET) 中获得了以下代码,并尝试重新实现它。原始样本工作正常。在我的版本中,当我尝试编译时出现错误。
private void AddHandlers()
{
// Add handlers for VMR purpose
this.Paint += new PaintEventHandler(Form1_Paint); // for WM_PAINT
this.Resize += new EventHandler(Form1_ResizeMove); // for WM_SIZE
this.Move += new EventHandler(Form1_ResizeMove); // for WM_MOVE
SystemEvents.DisplaySettingsChanged += new EventHandler(SystemEvents_DisplaySettingsChanged); // for WM_DISPLAYCHANGE
handlersAdded = true;
}
private void RemoveHandlers()
{
// remove handlers when they are no more needed
handlersAdded = false;
this.Paint -= new PaintEventHandler(Form1_Paint);
this.Resize -= new EventHandler(Form1_ResizeMove);
this.Move -= new EventHandler(Form1_ResizeMove);
SystemEvents.DisplaySettingsChanged -= new EventHandler(SystemEvents_DisplaySettingsChanged);
}
错误
错误 1 当前上下文 Form1.cs 中不存在
名称“Marshal” 错误 2 当前上下文 Form1.cs 中不存在名称“Marshal”
错误 3 当前上下文 Form1 中不存在名称“Form1_ResizeMove”。 cs
错误 4 当前上下文中不存在名称“Form1_Paint”Form1.cs
错误 5 当前上下文中不存在名称“Form1_ResizeMove” Form1.cs
错误 6 当前上下文中 Form1 中不存在名称“Form1_ResizeMove” .cs
错误 7 当前上下文中不存在名称“SystemEvents_DisplaySettingsChanged”Form1.cs
错误 10 名称“Form1_ResizeMove”当前上下文中不存在 Form1.cs
错误 11 当前上下文 Form1.cs 中不存在名称“SystemEvents_DisplaySettingsChanged”
任何帮助表示赞赏。
谢谢。