的GtkButton的GTK修改背景颜色 [英] GTK Modifying Background Color of GtkButton

查看:575
本文介绍了的GtkButton的GTK修改背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图改变背景/前景颜色....使用GTK +和C。

Trying to change background/foreground color....Using Gtk+ and C.

  GdkColor color;
  gdk_color_parse( "#0080FF", &color );
  gtk_widget_modify_fg( GTK_WIDGET(button), GTK_STATE_SELECTED, &color );
  gtk_widget_modify_fg( GTK_WIDGET(button), GTK_STATE_NORMAL, &color );

我使用上述功能,但它没有给出任何结果。

I am using above functionality but it is not giving any results.

我要寻找的东西在这个问题问(但在C):结果
<一href=\"http://stackoverflow.com/questions/1241020/gtk-create-a-colored-regular-button\">http://stackoverflow.com/questions/1241020/gtk-create-a-colored-regular-button

I am looking for something asked in this question(But in C):
http://stackoverflow.com/questions/1241020/gtk-create-a-colored-regular-button

如何使用按钮样式更改按钮的样式?
任何人可以提供一些例子吗?

how to Change Style of Button using button Style? Can anybody provide some examples?

推荐答案

GdkColor color;

gdk_color_parse ("red", &color);

gtk_widget_modify_bg ( GTK_WIDGET(button), GTK_STATE_NORMAL, &color);

请注意,我们正在修改 BG 而不是 FG

这篇关于的GtkButton的GTK修改背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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