On 3/21/06, Graham Oneale <[EMAIL PROTECTED]> wrote:
>
> Is it possible to set a background color on any of these widgets?
>
> I have an application in which certain container objects will require a
> background color and foreground color.

http://ometer.com/gtk-colors.html has some useful info.

It can sometimes be tricky to determine where a widget is getting its
colour choice from, whether it's using Fg, Base, or Bg, and which
state it's using.

It's made harder when some widgets simply defer to the background of
the widgets behind them. Tthis is the case with containers' borders.
Try the following code:

using System;
using Gtk;

class WindowTester {
     static void Main ()
     {
          Application.Init ();
          Window window = new Window ("This is a window");
          window.DeleteEvent += delegate {Application.Quit ();};
          window.SetDefaultSize (200, 200);

          Table tab = new Table (2, 2, true);
          window.Add (tab);
          tab.BorderWidth = 10;

          tab.Attach (new Button ("One"), 0, 1, 0, 1);
          tab.Attach (new Button ("Two"), 0, 1, 1, 2);
          tab.Attach (new Button ("Three"), 1, 2, 0, 2);

          window.ModifyBg (StateType.Normal, new Gdk.Color(255, 0, 0));

          window.ShowAll ();
          Application.Run ();
     }
}



Hope this helps,

Michael Hutchinson
_______________________________________________
Gtk-sharp-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to