在gtktreeview中加载图片之后,下一个问题就是如何实现像qq一样的图片跳动效果,其实很容易实现,只续加载两个图片,轮流替换就行,有时候gtk window不刷新,我们设一下他的title.图片就跳动起来了。代码如下:
public Gdk.Pixbuf buf2;
public Gdk.Pixbuf buf3;
buf2 = new Gdk.Pixbuf("info.png");
buf3 = new Gdk.Pixbuf("info1.png");
System.Timers.Timer t3 = new System.Timers.Timer(200);
t3.Elapsed += new ElapsedEventHandler(CheckMsg);
t3.AutoReset = true;
t3.Enabled = true;
public void CheckMsg(object o, EventArgs args)
{
Gtk.TreeIter iter;
try{
MsgItem item = msgHandle._head;
if(_bshow)
{
while(item != null)
{
if(GetTreeIter(item._uid, out iter))
{
store.SetValue(iter,0,buf2);
win.Title = item._uid;
}
}
}
else
{
while(item != null)
{
if(GetTreeIter(item._uid,out iter))
{
store.SetValue(iter,0,buf3);
}
win.Title="";
}
}
}catch(Exception e)
{}
}