您的位置:首页 > 编程语言 > C#

在gnome下用C#开发一个简单的窗口

2005-12-06 21:03 465 查看
终于发现ATI的显卡驱动可以用了,于是可以不再忍受800*600的分辨率了
做为一个.net爱好者怎么可以不尝试一下mono呢?
于是apt安装mono,顺便赞一把debian using System;
using Gtk;

public class MyWindow : Window
{
public MyWindow () : base ("MyWindow")
{
this.SetDefaultSize (400, 300);
this.DeleteEvent += new DeleteEventHandler (OnMyWindowDelete);
Button mybtn = new Button("Click me");
mybtn.Clicked+=new EventHandler (mybtn_click);
this.Add(mybtn);
this.ShowAll ();
}

void OnMyWindowDelete (object sender, DeleteEventArgs a)
{
Application.Quit ();
a.RetVal = true;
}

void mybtn_click(object sender,EventArgs args)
{
MessageDialog md = new MessageDialog((Window)this,
DialogFlags.DestroyWithParent,
MessageType.Question,
ButtonsType.YesNo,
"Do you really want to exit?");
ResponseType result = (ResponseType)md.Run();
md.Destroy();
if(result==ResponseType.Yes)
this.Destroy();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: