mail-archives/gtk-sharp-list/2006-February/006962.html

143 строки
6.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Changing the background color of button
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Changing%20the%20background%20color%20of%20button&In-Reply-To=43FB738E.2040806%40free.fr">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="006961.html">
<LINK REL="Next" HREF="006963.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Changing the background color of button</H1>
<B>Paulo Augusto</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Changing%20the%20background%20color%20of%20button&In-Reply-To=43FB738E.2040806%40free.fr"
TITLE="[Gtk-sharp-list] Changing the background color of button">PauloMorfeo at portugalmail.pt
</A><BR>
<I>Thu Feb 23 01:46:55 EST 2006</I>
<P><UL>
<LI>Previous message: <A HREF="006961.html">[Gtk-sharp-list] Changing the background color of button
</A></li>
<LI>Next message: <A HREF="006963.html">[Gtk-sharp-list] Changing the background color of button
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#6962">[ date ]</a>
<a href="thread.html#6962">[ thread ]</a>
<a href="subject.html#6962">[ subject ]</a>
<a href="author.html#6962">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 &#224;s 21:09 +0100, xiii29 escreveu:
&gt;<i> Thanks ...
</I>&gt;<i>
</I>&gt;<i> I've tried but it does'nt work ...
</I>&gt;<i>
</I>&gt;<i>
</I>&gt;<i> Paulo Augusto a &#233;crit :
</I>&gt;<i> &gt; I was puzzled by the same thing about buttons for a long time until i
</I>&gt;<i> &gt; figured it out.
</I>&gt;<i> &gt; Try changing the foreground, instead.
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; S&#225;b, 2006-02-18 &#224;s 00:28 +0100, xiii29 escreveu:
</I>&gt;<i> &gt;
</I>&gt;<i> &gt; &gt; Hi,
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; I'm wondering how to change the background color of a button. I'm able
</I>&gt;<i> &gt; &gt; to change label's one but not the button's one ...
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; Here is the code I'm using :
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; // -5.1.1-
</I>&gt;<i> &gt; &gt; Gtk.HBox hbox = new Gtk.HBox();
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; // --&gt; Label
</I>&gt;<i> &gt; &gt; // -----&gt; Event Box
</I>&gt;<i> &gt; &gt; Gtk.EventBox box = new Gtk.EventBox();
</I>&gt;<i> &gt; &gt; // -----&gt; ModifyBG
</I>&gt;<i> &gt; &gt; box.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255,
</I>&gt;<i> &gt; &gt; 0, 0));
</I>&gt;<i> &gt; &gt; // -----&gt; Creating Label
</I>&gt;<i> &gt; &gt; Gtk.Label lbl = new Gtk.Label(objP.Name);
</I>&gt;<i> &gt; &gt; // ----&gt; Adding Label to box
</I>&gt;<i> &gt; &gt; box.Add(lbl);
</I>&gt;<i> &gt; &gt; // ----&gt; Adding box to HBOX
</I>&gt;<i> &gt; &gt; hbox.PackStart(box);
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; // --&gt; Bouton
</I>&gt;<i> &gt; &gt; // -----&gt; Event Box
</I>&gt;<i> &gt; &gt; box = new Gtk.EventBox();
</I>&gt;<i> &gt; &gt; // -----&gt; ModifyBG
</I>&gt;<i> &gt; &gt; box.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 255,
</I>&gt;<i> &gt; &gt; 0, 0));
</I>&gt;<i> &gt; &gt; // -----&gt; Creating Label
</I>&gt;<i> &gt; &gt; Gtk.Button btn = new Gtk.Button(objP.Name);
</I>&gt;<i> &gt; &gt; btn.ModifyBg(Gtk.StateType.Normal, new Gdk.Color( 0,
</I>&gt;<i> &gt; &gt; 255, 0));
</I>&gt;<i> &gt; &gt; // ----&gt; Adding Label to box
</I>&gt;<i> &gt; &gt; box.Add(btn);
</I>&gt;<i> &gt; &gt; // ----&gt; Adding box to HBOX
</I>&gt;<i> &gt; &gt; hbox.PackStart(box);
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; // -5.1.3-
</I>&gt;<i> &gt; &gt; objVBox.Add(hbox);
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; &gt; _______________________________________________
</I>&gt;<i> &gt; &gt; Gtk-sharp-list maillist - <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">Gtk-sharp-list at lists.ximian.com</A>
</I>&gt;<i> &gt; &gt; <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
</I>&gt;<i> &gt; &gt;
</I>&gt;<i> &gt; _______________________________________________
</I>&gt;<i> &gt; Gtk-sharp-list maillist - <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">Gtk-sharp-list at lists.ximian.com</A>
</I>&gt;<i> &gt; <A HREF="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">http://lists.ximian.com/mailman/listinfo/gtk-sharp-list</A>
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i> &gt;
</I>&gt;<i>
</I></PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="006961.html">[Gtk-sharp-list] Changing the background color of button
</A></li>
<LI>Next message: <A HREF="006963.html">[Gtk-sharp-list] Changing the background color of button
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#6962">[ date ]</a>
<a href="thread.html#6962">[ thread ]</a>
<a href="subject.html#6962">[ subject ]</a>
<a href="author.html#6962">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>