我想在我的 Gtk# 应用程序中有很多表单。当用户关闭所有表单时,我想退出应用程序。我尝试使用下一个代码:
protected void OnDeleteEvent (object sender, DeleteEventArgs a)
{
/*Application.Quit ();
a.RetVal = true;*/
if(System.Windows.Forms.Application.OpenForms.Count==0)
{
Gtk.Application.Quit ();
a.RetVal = true;
}
}
但是 System.Windows.Forms.Application.OpenForms.Count 总是返回“0”,无论打开表单的数量如何(OS Ubuntu 12.04)。我该如何解决这个问题并获得实际打开表格的数量?提前致谢