制作一个GtkButton [英] Making a GtkButton round

查看:120
本文介绍了制作一个GtkButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案




  • 调整样式。基本集中没有圆整选项。某些主题引擎可能会提供边框图像规格或圆度,但无法在任何地方使用。
  • 强制一个看起来也是您想要的主题。这并不难,你只需加载一个gtkrc字符串来指定你想要的主题。您需要确保用户具有主题或者可以使用后备。

  • 按钮的子类并自行绘制。一种方法是将边框和浮雕设置为0,打包图像,并响应状态变化事件以使用适当的预光(悬停)图像。另一种方法是重写揭发事件并按照您的意愿绘制按钮。


How can I make GtkBtton round in shape?

解决方案

There are a few options.

  • Tweak the style. There is no roundness option in the base set. Some theme engines may provide border image specification or roundness but it will not work everywhere.
  • Force a theme that looks the way you want it too. This is not too hard you just load a gtkrc string that specifies the theme you want. You will need to ensure users have the theme or are ok with the fallback.
  • Subclass the button and draw it yourself. One way is to set border and relief to 0, pack an image, and respond to state change events to use appropriate pre-light (hover) images. Another way is to rewrite the expose event and draw the button as you wish.

这篇关于制作一个GtkButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆