当前上下文中不存在“元帅"名称 [英] The name ‘Marshal’ does not exist in the current context

查看:220
本文介绍了当前上下文中不存在“元帅"名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从bitmapmixer示例(DirectShow.NET)中获取了以下代码,并尝试重新实现它.原始样本工作正常.在我尝试编译的版本中,出现错误.

I got the code below from the bitmapmixer sample (DirectShow.NET) and i tried to reimplement it. The original sample works fine. In my version when I try to compile i get errors.

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中不存在名称元帅" 错误2在当前上下文Form1.cs中不存在名称元帅" 错误3在当前上下文Form1.cs中不存在名称"Form1_ResizeMove" 错误4在当前上下文Form1.cs中不存在名称"Form1_Paint" 错误5在当前上下文Form1.cs中不存在名称"Form1_ResizeMove" 错误6在当前上下文Form1.cs中不存在名称"Form1_ResizeMove" 错误7名称``SystemEvents_DisplaySettingsChanged''在当前上下文Form1.cs中不存在 错误10在当前上下文Form1.cs中不存在名称"Form1_ResizeMove" 错误11在当前上下文Form1.cs中不存在名称"SystemEvents_DisplaySettingsChanged"
任何帮助表示赞赏.

谢谢.




ERRORs

Error 1 The name ''Marshal'' does not exist in the current context Form1.cs
Error 2 The name ''Marshal'' does not exist in the current context Form1.cs
Error 3 The name ''Form1_ResizeMove'' does not exist in the current context Form1.cs
Error 4 The name ''Form1_Paint'' does not exist in the current context Form1.cs
Error 5 The name ''Form1_ResizeMove'' does not exist in the current context Form1.cs
Error 6 The name ''Form1_ResizeMove'' does not exist in the current context Form1.cs
Error 7 The name ''SystemEvents_DisplaySettingsChanged'' does not exist in the current context Form1.cs
Error 10 The name ''Form1_ResizeMove'' does not exist in the current context Form1.cs
Error 11 The name ''SystemEvents_DisplaySettingsChanged'' does not exist in the current context Form1.cs

Any help is appreciated.

Thanks.

推荐答案

您先前的问题已经解决了这个问题.
错误消息中存在的所有方法和/或名称都必须由编译器通过您的代码中的定义或通过引用程序集和名称空间来访问.

干杯
Your previous question already covered the problem.
All the methods and/or names present in the error messages need to be reachable by the compiler either through definition in your code or by reference to the assembly and namespace.

Cheers


这篇关于当前上下文中不存在“元帅"名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆