[Gtk-sharp-list] Transparent tray icon

Michael Hutchinson m.j.hutchinson at gmail.com
Thu Feb 7 14:15:06 EST 2008

On Feb 4, 2008 7:10 AM, Suco <sucotronic at gmail.com> wrote:
> I've find this documentation about tray icons with mono:
> http://www.mono-project.com/GtkSharpNotificationIcon
> But the result tray icon doesn't have a transparent background.
> This is my code
> this.icon = Gdk.Pixbuf.LoadFromResource("pru.png");
> Gtk.Image kk = new Gtk.Image(icon.ScaleSimple(24, 24, Gdk.InterpType.Hyper));
> EventBox eb = new EventBox();
> eb.Add(kk);
> eb.ButtonPressEvent += new ButtonPressEventHandler(OnTrayClicked);
> TrayIcon Icon = new TrayIcon("pru");
>    Icon.GdkWindow.SetBackPixmap (null, true);
> Icon.ShowAll();
> Any idea to solve it?

That page has unfortunately not been updated in 2.5 years, and it's
likely that some things have changed since it was last updated. It
also makes a lot of X11-specific call, which is not portable. It's
probably possible to make it work, but I'm not surre how. Did you try
it unscaled?

If you're using GTK# 2.10 or later, there's a new cross-platform
StatusIcon class that may be useful to you -- and also a TrayIcon
class that's X11 only but offers the ability to plug in arbitrary

Michael Hutchinson

More information about the Gtk-sharp-list mailing list