[Gtk-sharp-list] Using Pango from GTK#

Peter Johanson latexer at gentoo.org
Wed Jan 3 18:19:30 EST 2007


On Thu, Jan 04, 2007 at 12:06:51AM +0100, David Philippi wrote:
> Hello,
> 
> I'm trying to do simple text formatting on a Gtk.Label but I can't find out 
> how to do this. Could someone point me to documentation about this or show me 
> some example code for simple things like making text bold, changing size and 
> color or similiar...

You need to use pango markup
(http://www.gtk.org/api/2.6/pango/PangoMarkupFormat.html) to do this.
You can basically do this:

Gtk.Label label = new Gtk.Label ();
label.Markup = "<b>BOLD</b>";

or, if your label needs a mnemonic:

label.MarkupWithMnemonic = "<b>_BOLD</b>";

-pete

-- 
Peter Johanson
<latexer at gentoo.org>


More information about the Gtk-sharp-list mailing list