简体   繁体   English

在DockPanel文档中调用方法

[英]Call a Method in a DockPanel Document

I have a dictionary list of forms which are Documents within DockPanelSuite (Windows Forms) When a button on the main form is pressed all the document's "Contents" contained in the first control (ScintillaNet Editor instance) of the Document Form should be saved. 我有一个表单的字典列表,这些表单是DockPanelSuite(Windows窗体)中的文档。当按下主窗体上的按钮时,应保存文档窗体的第一个控件(ScintillaNet编辑器实例)中包含的所有文档“内容”。

However, accessing the Save() method of the form is proving frustrating. 但是,访问表单的Save()方法令人沮丧。 Currently this is the code: 当前这是代码:

private void btnCompile_Click(object sender, EventArgs e)
        {
            // Save the Project.
           foreach(var editor in EditorList)
            {
                if(editor.Key.StartsWith(CurrentProjectModel.Name))
                {
                    FrmCodeEditor fce = new FrmCodeEditor();
                    fce = (FrmCodeEditor)editor.Value;
                    fce.Save();
                }
            }

            IDA.Controllers.CLI.Exec exec = new Controllers.CLI.Exec();
            exec.ExecuteCompiler();
        }

editor is the name of the form, EditorList is the Dictionary which contains a list of all active Documents. editor是表单的名称,EditorList是Dictionary,其中包含所有活动Document的列表。 However, the fce.Save is not being found. 但是, fce.Save

Question All I want to do is iterate through all the open Documents which are FrmEditor types and call their Save method. 问题我要做的就是遍历所有打开的FrmEditor类型的Document,并调用其Save方法。 How can I do that? 我怎样才能做到这一点?

As it turned out - the method I was trying to call was static. 事实证明-我尝试调用的方法是静态的。 However, this was not being flagged in intellisense. 但是,在智能感知中并未对此进行标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM