我从MonoDevelop制作了一个GTK#2.0项目,它生成了两个文件:
Program.cs的
section.courses {
float: left;
width: 760px;
border-right: 1px solid #eeeeee;
margin-left: 30%;
}
MainWindow.cs:
using System;
using Gtk;
namespace Application
{
class MainClass
{
public static void Main(string[] args)
{
Application.Init();
MainWindow win = new MainWindow();
win.Show();
Application.Run();
}
}
}
I Pressed' Debug'按钮,不模仿任何代码。 然后编译器打印了这个:
using System;
using Gtk;
public partial class MainWindow : Gtk.Window
{
public MainWindow() : base(Gtk.WindowType.Toplevel)
{
Build();
}
protected void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
a.RetVal = true;
}
}
我在解决方案选项卡上看到了参考列表,并且存在Gtk.Application.Init,Run,Quit。那为什么会出现这个错误?
答案 0 :(得分:0)
将Program.cs修改为:
using System;
using Gtk;
namespace Application
{
class MainClass
{
public static void Main(string[] args)
{
Gtk.Application.Init();
MainWindow win = new MainWindow();
win.Show();
Gtk.Application.Run();
}
}
}
将MainWindow.cs修改为:
using System;
using Gtk;
public partial class MainWindow : Gtk.Window
{
public MainWindow() : base(Gtk.WindowType.Toplevel)
{
Build();
}
protected void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Gtk.Application.Quit();
a.RetVal = true;
}
}