【发布时间】:2021-04-05 15:41:31
【问题描述】:
所以我有两个类“SplashScreenForm”和“Program”,并且在事件中想要运行“MainForm”。 它看起来像这样:
public partial class SplashScreenForm : Form
{
public event EventHandler<int> RaiseUpdateEvent;
........
在“程序”中定义这样的类
static class Program
{
static Form SplashScreen;
static Form MainForm;
SplashScreen = new SplashScreenForm();
.........
但问题是,当我尝试访问事件时,它说“SplashScreenForm”不包含该事件。我该如何解决这个问题?
SplashScreen.RaiseUpdateEvent += SplashScreen_RaiseUpdateEvent;
错误提示:CS1061 C# 'Form' 不包含定义,并且找不到接受“Form”类型的第一个参数的可访问扩展方法(您是否缺少 using 指令或程序集引用?)
【问题讨论】: