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

Paulo Augusto PauloMorfeo at portugalmail.pt
Thu Feb 23 01:46:55 EST 2006


You seem to be using a Gtk.EventBox, adding to it a label and then
trying to change the colour of the event box.
I don't know much of Gtk but i doubt that that is suposed to work... The
event box is just used to get events, not for showing. So, you can
change the colour of the EventBox that it will never show. Maybe you
should be trying instead to change the colour of the label which is
inside the EventBox and is what's really showing.


About buttons, i know i'm using:
Gtk.Button.ModifyFg (...);

And it changes the colour of the button. Maybe you should try instead to
use a button like i am. Unless you reallt want to mess around with
labels and event boxes.



Ter, 2006-02-21 às 21:09 +0100, xiii29 escreveu:
> Thanks ...
> 
> I've tried but it does'nt work ... 
> 
> 
> Paulo Augusto a écrit : 
> > I was puzzled by the same thing about buttons for a long time until i
> > figured it out.
> > Try changing the foreground, instead.
> > 
> > 
> > 
> > Sáb, 2006-02-18 às 00:28 +0100, xiii29 escreveu:
> >   
> > > 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);
> > > 
> > > _______________________________________________
> > > Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> > >     
> > _______________________________________________
> > Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> > 
> > 
> >   
> 


More information about the Gtk-sharp-list mailing list