最近在写一个.net客户端程序,其中要用到在treeview中显示图片,经过查找mono的在线文档,多次测试,终于解决了该问题,测试代码如下:
Gtk.TreeStore store = new Gtk.TreeStore (typeof(Gdk.Pixbuf),typeof (string));
Gtk.Treeview tv = new Gtk.TreeView (store);
tv.AppendColumn ("", new CellRendererPixbuf(), "pixbuf", 0);
tv.AppendColumn ("", new CellRendererText (), "text", 1);
tv.RowActivated += new RowActivatedHandler (on_user_click);
tv.Show();
Gdk.Pixbuf buf = new Gdk.Pixbuf("info.png");
String cal = "我的用户";
store.AppendValues(buf, "xxxx");