[Gtk-sharp-list] simple button style change ...

ted leslie tleslie at tcn.net
Thu Aug 4 08:57:40 EDT 2005


i am just trying to get the color of a button to change, i think i exhausted
ever color type in the widget below, but none take effect,
Relief takes effect when i change it from one type to another, but nothing else,
What am i doing wrong,
I use the GTKmm pages for documentation because i havnt found much
on GTK# anywhere, is there some ..
No one seems to do this on any of the GTK# applications in the mono site 
so i am baffed..

    Gtk.RcStyle rc_style;
    rc_style= new Gtk.RcStyle();

    Gdk.Color color;

    color.Red = 65535;
    color.Green = 0;
    color.Blue = 0;
    color.Pixel = 65535;  // whats this?

    btn3.Style=null;
    btn3.ModifyStyle(rc_style);
    btn3.Relief=Gtk.ReliefStyle.Half;  // this works and we see impact!!!
btn3.ModifyBg(Gtk.StateType.Selected, color);
btn3.ModifyFg(Gtk.StateType.Selected, color);
btn3.ModifyBase(Gtk.StateType.Selected, color);
Console.WriteLine(btn3.Style.BaseColors[1]);
Console.WriteLine(btn3.Style.Foregrounds[0]);

btn3.Style.DarkColors[0]=color;
btn3.Style.DarkColors[1]=color;
btn3.Style.DarkColors[2]=color;
btn3.Style.DarkColors[3]=color;
btn3.Style.DarkColors[4]=color;
btn3.Style.LightColors[0]=color;
btn3.Style.LightColors[1]=color;
btn3.Style.LightColors[2]=color;
btn3.Style.LightColors[3]=color;
btn3.Style.LightColors[4]=color;
btn3.Style.BaseColors[1]=color;
btn3.Style.BaseColors[0]=color;
btn3.Style.BaseColors[2]=color;
btn3.Style.BaseColors[3]=color;
btn3.Style.BaseColors[4]=color;
btn3.Style.Foregrounds[0]=color;
btn3.Style.Foregrounds[1]=color;
btn3.Style.Foregrounds[2]=color;
btn3.Style.Foregrounds[3]=color;
btn3.Style.Foregrounds[4]=color;

..... assign widget into another container ....


More information about the Gtk-sharp-list mailing list