[Gtk-sharp-list] Gtk.Label.ModifyBg Problems
Gregory Hayes <firstname.lastname@example.org>
Sat, 2 Apr 2005 15:20:55 -0500
I'm trying to modify a Label to have a non-default background color.
The code below doesn't seem to cut it however. I manage to set the
text color, but the background of the label always stays the same.
Setting the GdkWindow.Background also has no effect (though I
sometimes see a flash of the color befor ethe widget is fully drawn.)
The effect I get from just using Pango markup to set the background is
also not what I want, I need the entire lable to be the color.
If I am approching this wrong, let me know. I attempted to do this
with a Gtk.Drawable, but I could never seem to render a Pango layout
public void ShowWord (string word)
// The following line works fine
imageCanvas.ModifyFg (Gtk.StateType.Normal, fontColor );
// The line below does nothing...
imageCanvas.ModifyBg (Gtk.StateType.Normal, new Gdk.Color ( 200, 0, 0) );
// Oddly the below line doesnt work either
//imageCanvas.GdkWindow.Background = new Gdk.Color (200,200,200);
imageCanvas.Markup = "<span font_desc=\"" + fontName +"\">" + word
imageCanvas.UseMarkup = true;
imageCanvas.CanFocus = false;