gtk+2.0设置按钮背景图片

效果
在这里插入图片描述

在gtk+2.0中,可以通过gtk_widget_get_style获取按钮的样式,并设置bg_pixmap背景图片的方法。
其中bg_pixmap数组有下面的枚举类型,代表不同情况下的图片类型。这意味着你可以在按钮正常,鼠标覆盖和鼠标按下的时候分别设置不同的图片。

enum GtkStateType
typedef enum
{
  GTK_STATE_NORMAL,
  GTK_STATE_ACTIVE,
  GTK_STATE_PRELIGHT,
  GTK_STATE_SELECTED,
  GTK_STATE_INSENSITIVE
} GtkStateType;
This type indicates the current state of a widget; the state determines how the widget is drawn. The GtkStateType enumeration is also used to identify different colors in a GtkStyle for drawing, so states can be used for subparts of a widget as well as entire widgets.

GTK_STATE_NORMAL

St

猜你喜欢

转载自blog.csdn.net/m0_60352504/article/details/139810950