GTK# Widget in front of another widget

。_饼干妹妹 提交于 2019-12-11 14:46:33

问题


How to bring a widget to the front of another widget? I want to put the timeLeft Label in front of the box DrawingArea

My Code :

box.SetSizeRequest((int)Math.Floor(size*2.5), size);
box.ExposeEvent += boxExpose;
theMainWindow.winFix.Put(box, x, y);
box.Show();

Pango.FontDescription fontdesc = Pango.FontDescription.FromString("Lucida Console " + (size - 6));
timeLeft.ModifyFont(fontdesc);
timeLeft.SetSizeRequest((int)Math.Floor(size*2.5)-6, size-6);

theMainWindow.winFix.Put(timeLeft, x+3, y+3);   
timeLeft.Show();

回答1:


So Labels in gtk# don't have there own gdk window and draw on to the parent widget (the window in this case). To get around this you can wrap the label in an EventBox widget and add that to the window. This works because the event box is giving the label a window to draw on.



来源:https://stackoverflow.com/questions/23442281/gtk-widget-in-front-of-another-widget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!