【发布时间】:2008-12-03 17:25:29
【问题描述】:
我来自 c# 背景,正在将一个 vb.net windows 窗体应用程序转换为 c#。 我有一个名为 associateForm 的 Windows 窗体。 在代码中,开发人员引用关联表单如下:-
Private Sub NotifyIcon1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles EMS.MouseDoubleClick
If e.Button = Windows.Forms.MouseButtons.Left Then
If associateForm.WindowState = FormWindowState.Normal And associateForm.Visible = True Then
associateForm.WindowState = FormWindowState.Minimized
Else
associateForm.WindowState = FormWindowState.Normal
End If
associateForm.Show()
associateForm.Focus()
'bring to front of other windows
associateForm.Activate()
End If
End Sub
但问题是 associateForm 没有在执行该方法的类中实例化。类也不是静态的。代码中的任何地方似乎也没有该类的实例。任何人都可以解释为什么这似乎有效,但是当我在 C# 中尝试这个时,它没有。
【问题讨论】: