[Gtk-sharp-list] Changing the background color of button

xiii29 xiii29 at free.fr
Fri Feb 17 18:28:09 EST 2006


Hi,

I'm wondering how to change the background color of a button. I'm able 
to change label's one but not the button's one ...

Here is the code I'm using :

                // -5.1.1-
                Gtk.HBox hbox = new Gtk.HBox();
               
                // --> Label
                // -----> Event Box
                Gtk.EventBox box = new Gtk.EventBox();
                // -----> ModifyBG
                box.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255, 
0, 0));
                // -----> Creating Label
                Gtk.Label lbl = new Gtk.Label(objP.Name);
                // ----> Adding Label to box
                box.Add(lbl);
                // ----> Adding box to HBOX
                hbox.PackStart(box);
               
               
                // --> Bouton
                // -----> Event Box
                box = new Gtk.EventBox();
                // -----> ModifyBG
                box.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255, 
0, 0));
                // -----> Creating Label
                Gtk.Button btn = new Gtk.Button(objP.Name);
                btn.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0, 
255, 0));
                // ----> Adding Label to box
                box.Add(btn);
                // ----> Adding box to HBOX
                hbox.PackStart(box);
               
                // -5.1.3-
                objVBox.Add(hbox);



More information about the Gtk-sharp-list mailing list